10 More Discussions You Might Find Interesting
1. Programming
I am getting an error function in date formate while importing the date ccolumn in oracle sql developer tool
My date format in table is 6-Nov-14 and while importing its converted to 6/11/14 eventhough the format is as 6-Nov-14 in excel.
could you please let help me out what I need to change... (6 Replies)
Discussion started by: ramkumar15
6 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I have a requirement where i have to spool some data to a file. i have achived the desired target but m facing one issue. i have attached the script and the output.
i checked the data length in the table but it is only 45 for column 1.
can you tell me how to remove these extra... (4 Replies)
Discussion started by: Mohammed_Tabish
4 Replies
3. Shell Programming and Scripting
Hi,
Im writing a script to run a bit of sql(via sqlplus) that pulls back some data and spools it to a file, I want the spool file to only display the data, with no sql command at the top and no reports at the bottom ie(# of records recieved).
I am currently doing it via a grep command but... (1 Reply)
Discussion started by: Magezy
1 Replies
4. Shell Programming and Scripting
I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want.
How can I... (3 Replies)
Discussion started by: MxC
3 Replies
5. Shell Programming and Scripting
Hi All,
I am spooling the data some sql queries into a single file but wanted to know how to format the data of the file generated by spool.
#!/bin/sh
unset -f USAGE
USAGE () {
clear
echo "############################USAGE#######################\n"
echo "Incorrect number of... (2 Replies)
Discussion started by: ss_ss
2 Replies
6. Shell Programming and Scripting
Hi,
I'm creating a shell script to dynamically create a recreate controlfile for an Oracle database. I need to read a cold backup file system, and make some changes to these files.
Let's say for argument sake the directory name is /ebsprod_c/oradata and it looks like this:... (6 Replies)
Discussion started by: exm
6 Replies
7. Shell Programming and Scripting
I would like to use the result of a query in another query. How do I redirect/add the output to another variable?
$result = odbc_exec($connect, $query);
while ($row = odbc_fetch_array($result)) {
echo $row,"\n";
}
odbc_close($connect);
?>
This will output hostnames:
host1... (0 Replies)
Discussion started by: hazno
0 Replies
8. Programming
Is there anyway to spool my select statement into spool files of max 10000 records each?
eg I have a select statement that will return 45000 records.
A normal spool command will output the 45000 into just one spool file.
How can I make sqlplus do this?
00001 - 10000 records --- spool... (3 Replies)
Discussion started by: Leion
3 Replies
9. Shell Programming and Scripting
Hi,
Am using informix database. When i give "isqlrf <database name> - " from the command prompt , i get connected to the database and i can run sql queries..
I am moving to freeBSD and when i give the same command at the prompt i get an error : Index already exists on column
Why is this... (0 Replies)
Discussion started by: jisha
0 Replies
10. Shell Programming and Scripting
Hi friends,
I have written a script which retrieves one value from the database.
It takes time for the sql query to get the desired output. So the query runs fine from TOAD or from UNIX console.
However if I put this in a script it doesn't work. The script is as below.
#! /bin/ksh... (2 Replies)
Discussion started by: vivek_damodaran
2 Replies
MYSQL_DB_QUERY(3) 1 MYSQL_DB_QUERY(3)
mysql_db_query - Selects a database and executes a query on it
SYNOPSIS
Warning
This function was deprecated in PHP 5.3.0, and will be removed in the future, along with the entirety of the original MySQL exten-
sion. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more
information. Alternatives to this function include:
omysqli_select_db(3) then the query
o PDO::__construct
resource mysql_db_query (string $database, string $query, [resource $link_identifier = NULL])
DESCRIPTION
mysql_db_query(3) selects a database, and executes a query on it.
o $database
- The name of the database that will be selected.
o $query
- The MySQL query. Data inside the query should be properly escaped.
o $
link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is
assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection
is found or established, an E_WARNING level error is generated.
Returns a positive MySQL result resource to the query result, or FALSE on error. The function also returns TRUE/ FALSE for INSERT/ UPDATE/
DELETE queries to indicate success/failure.
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | This function now throws an E_DEPRECATED notice. |
| | |
+--------+---------------------------------------------------+
Example #1
mysql_db_query(3) alternative example
<?php
if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('mysql_dbname', $link)) {
echo 'Could not select database';
exit;
}
$sql = 'SELECT foo FROM bar WHERE id = 42';
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database
";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['foo'];
}
mysql_free_result($result);
?>
Note
Be aware that this function does NOT switch back to the database you were connected before. In other words, you can't use this
function to temporarily run a sql query on another database, you would have to manually switch back. Users are strongly encouraged
to use the database.table syntax in their sql queries or mysql_select_db(3) instead of this function.
mysql_query(3), mysql_select_db(3).
PHP Documentation Group MYSQL_DB_QUERY(3)