11-19-2009
Thanks for the response.I am using DB2 Database. Please help with the command for the same
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Any link or example to write shell script for the Connecting Oracle for Quering through SQL
thanks in advance ...
Cheers !!
Mehul Doshi (3 Replies)
Discussion started by: mehuldoshi
3 Replies
2. Shell Programming and Scripting
HI ALL
i have a requirement like this. i have to write a shell script to run a sql query. DB is oracle. once the query is run, the results of the query has to be published in a data file. can you please advice me how to go about it. i am absolutely new to shell scripts and this is a part of my job. (14 Replies)
Discussion started by: ragha81
14 Replies
3. Shell Programming and Scripting
Hi ALL,
I need an help in connecting to oracle database, executing a select query and printing it on the screen. Can any one please write a simple code or psuedo code and let me know.
select query returns multiple values( say select name from emp)
Thanks in advance
LM (1 Reply)
Discussion started by: lijju.mathew
1 Replies
4. Shell Programming and Scripting
query sql using shell script, is it possible?
my friend told me to do a file.sql and link to my shell script, but can i query sql using shell script?
thanks in advance! (2 Replies)
Discussion started by: kingpeejay
2 Replies
5. Shell Programming and Scripting
Hi Team,
Can you please help me to resolve this issue.
Am unable to use this $ symbol in sql query in the shell script.
For Example:
# !/bin/sh
export USER_NAME=XXX
export PASSWORD=YYY
export ORACLE_SID=xamdb
echo $ORACLE_SID
echo " Session Details ..."
... (1 Reply)
Discussion started by: indira_s
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have one SQL file prepared in UNIX and one script that is executing that.
In SQL i have Update and create queries.
I want to introduce conditions in SQL file (in UNIX) that if either of the create or update query failes whole transaction should be rollback.
I just have 1 create... (2 Replies)
Discussion started by: abhii
2 Replies
7. Red Hat
hey , i am using this code to store value of a sql query and and then use
it in other query but after some time , but it is not working. please help
#!/bin/bash
val_1=$( sqlplus -s rte/rted2@rel76d2 << EOF
setting heading off
select max(stat_id) from cvt_stats;
exit
EOF
)
nohup... (5 Replies)
Discussion started by: ramsavi
5 Replies
8. Shell Programming and Scripting
Hi All,
I have a query with output below
select 'create synonym "'||TABLE_NAME||'" for '||Table_owner||'."'||table_name||'"'||chr(59) from user_synonyms;
==================
create synonym "RV_SBC_SIG" for WFCONTROLLER_TE."RV_SBC_SIG";
create synonym "AQM_TASK" for AWQM_TE."AQM_TASK";... (2 Replies)
Discussion started by: pvmanikandan
2 Replies
9. Shell Programming and Scripting
Hi I would like to embed a sql query in my shell script.
Also, before any the sql query is executed, i would like to validate username and password. (1 Reply)
Discussion started by: arghadeep adity
1 Replies
10. Shell Programming and Scripting
Hello All,
I'm trying to put together a shell script that will:
1. connect to an oracle database
2. execute a query
3. save the output to a csv file
I know that I can execute the sqlplus -s user/pass @dbsid and get logged in. What I would like to do is have my query in a separate text... (9 Replies)
Discussion started by: bbbngowc
9 Replies
LEARN ABOUT PHP
pdo.query
PDO.QUERY(3) 1 PDO.QUERY(3)
PDO
::query - Executes an SQL statement, returning a result set as a PDOStatement object
SYNOPSIS
public PDOStatement PDO::query (string $statement)
DESCRIPTION
PDOStatement PDO::query (string $statement, int $PDO::FETCH_COLUMN, int $colno) PDOStatement PDO::query (string $statement, int
$PDO::FETCH_CLASS, string $classname, array $ctorargs) PDOStatement PDO::query (string $statement, int $PDO::FETCH_INTO, object
$object)
PDO.query(3) executes an SQL statement in a single function call, returning the result set (if any) returned by the statement as a
PDOStatement object.
For a query that you need to issue multiple times, you will realize better performance if you prepare a PDOStatement object using PDO.pre-
pare(3) and issue the statement with multiple calls to PDOStatement.execute(3).
If you do not fetch all of the data in a result set before issuing your next call to PDO.query(3), your call may fail. Call PDOState-
ment.closeCursor(3) to release the database resources associated with the PDOStatement object before issuing your next call to
PDO.query(3).
Note
Although this function is only documented as having a single parameter, you may pass additional arguments to this function. They
will be treated as though you called PDOStatement.setFetchMode(3) on the resultant statement object.
PARAMETERS
o $statement
- The SQL statement to prepare and execute. Data inside the query should be properly escaped.
RETURN VALUES
PDO.query(3) returns a PDOStatement object, or FALSE on failure.
EXAMPLES
Example #1
Demonstrate PDO::query
A nice feature of PDO.query(3) is that it enables you to iterate over the rowset returned by a successfully executed SELECT state-
ment.
<?php
function getFruit($conn) {
$sql = 'SELECT name, color, calories FROM fruit ORDER BY name';
foreach ($conn->query($sql) as $row) {
print $row['name'] . " ";
print $row['color'] . " ";
print $row['calories'] . "
";
}
}
?>
The above example will output:
apple red 150
banana yellow 250
kiwi brown 75
lemon yellow 25
orange orange 300
pear green 150
watermelon pink 90
SEE ALSO
PDO.exec(3), PDO.prepare(3), PDOStatement.execute(3).
PHP Documentation Group PDO.QUERY(3)