01-03-2008
what do you mean could not execute the sql statements. what errors did you receive?
also, please use the code tags(the # icon) around your code.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a shell script which resides on three SCO machines containing some simple sqlplus statments. I need to run these scripts remotely. Currently, I am trying to use rsh to do so:
rsh hostname myscript args
The problem is that the arguments to the sqlplus statements in the remote shell... (4 Replies)
Discussion started by: Madbreaks
4 Replies
2. Shell Programming and Scripting
Hi-
I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment...
I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies
3. Shell Programming and Scripting
i want to use multple sql count statements and store these count values in unix variable but in one connection only i.e. in only 1 time database should be hit ,which is the main requirement. (1 Reply)
Discussion started by: sw@pnil
1 Replies
4. Shell Programming and Scripting
I've got:
isql -U $USERID -S $SERVER -D $DATABASE -i inputfile.sql -o outputfile.txt
in inputfile I have:
go
sql#1
go
sql#2
go
sql#3
go
I also tried without "go" and with";" instead which did not work
SQL statements will work if I paste them directly into the script and use EOF
... (0 Replies)
Discussion started by: Cailet
0 Replies
5. UNIX for Dummies Questions & Answers
Hi guys,
I am new on here, I have a function in oracle that returns a specific value:
create or replace
PACKAGE BODY "CTC_ASDGET_SCHED" AS
FUNCTION FN_ASDSCHEDULE_GET
RETURN VARCHAR2
AS
BEGIN
DECLARE
ASDSchedule varchar2(6);
ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies
6. UNIX for Dummies Questions & Answers
Hello Guys...
I want a small help from you guys.
Actually in Oracle, we are having a utlity called spool through which can store whatever SQL statements executed and other queries and the output of those queries in a file
So, similarly in Unix, if I start a session executing a number of Unix... (2 Replies)
Discussion started by: mraghunandanan
2 Replies
7. Shell Programming and Scripting
Hello members,
I'm working on the Solaris environment and the DB i'm using is Oracle 10g.
Skeleton of what I'm attempting;
Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a... (4 Replies)
Discussion started by: novice82
4 Replies
8. UNIX for Advanced & Expert Users
Hi Experts:
I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies
9. Shell Programming and Scripting
Hi all.
This is my first post on this forum. I've previously found great help in the huge knowledgebase that is here, but this time I have not been able to find a solution to my problem.
I have a large text file that looks like this:
typedef struct ABC_struct_nbr1_ {
char attr1; /*... (0 Replies)
Discussion started by: Yagi Uda
0 Replies
10. Shell Programming and Scripting
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
LEARN ABOUT PHP
cubrid_execute
CUBRID_EXECUTE(3) 1 CUBRID_EXECUTE(3)
cubrid_execute - Execute a prepared SQL statement
SYNOPSIS
resource cubrid_execute (resource $conn_identifier, string $sql, [int $option])
DESCRIPTION
bool cubrid_execute (resource $request_identifier, [int $option])
The cubrid_execute(3) function is used to execute the given SQL statement. It executes the query by using $conn_identifier and SQL, and
then returns the request identifier created. It is used for simple execution of query, where the parameter binding is not needed. In addi-
tion, the cubrid_execute(3) function is used to execute the prepared statement by means of cubrid_prepare(3) and cubrid_bind(3). At this
time, you need to specify arguments of $request_identifier and $option.
The $option is used to determine whether to get OID after query execution and whether to execute the query in synchronous or asynchronous
mode. CUBRID_INCLUDE_OID and CUBRID_ASYNC (or CUBRID_EXEC_QUERY_ALL if you want to execute multiple SQL statements) can be specified by
using a bitwise OR operator. If not specified, neither of them isselected. If the flag CUBRID_EXEC_QUERY_ALL is set, a synchronous mode
(sync_mode) is used to retrieve query results, and in such cases the following rules are applied:
oThe return value is the result of the first query.
o If an error occurs in any query, the execution is processed as a failure.
o In a query composed of q1 q2 q3, if an error occurs in q2 after q1 succeeds the execution, the result of q1 remains valid. That
is, the previous successful query executions are not rolled back when an error occurs.
o If a query is executed successfully, the result of the second query can be obtained using cubrid_next_result(3).
If the first argument is $request_identifier to execute the cubrid_prepare(3) function, you can specify an option, CUBRID_ASYNC only.
PARAMETERS
o $conn_identifier
-Connection identifier.
o $sql
-SQL to be executed.
o $option
-Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC, CUBRID_EXEC_QUERY_ALL.
o $request_identifier
-cubrid_prepare(3) identifier.
RETURN VALUES
Request identifier, when process is successful and first param is conn_identifier; TRUE, when process is successful and first argument is
request_identifier.
FALSE, when process is unsuccessful.
CHANGELOG
+--------+----------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+----------------------------------------+
| 8.4.0 | |
| | |
| | Add new option CUBRID_EXEC_QUERY_ALL. |
| | |
+--------+----------------------------------------+
EXAMPLES
Example #1
cubrid_execute(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$result = cubrid_execute($conn, "SELECT code FROM event WHERE name='100m Butterfly' and gender='M'", CUBRID_ASYNC);
$row = cubrid_fetch_array($result, CUBRID_ASSOC);
$event_code = $row["code"];
cubrid_close_request($result);
$history_req = cubrid_prepare($conn, "SELECT * FROM history WHERE event_code=?");
cubrid_bind($history_req, 1, $event_code, "number");
cubrid_execute($history_req);
printf("%-20s %-9s %-10s %-5s
", "athlete", "host_year", "score", "unit");
while ($row = cubrid_fetch_array($history_req, CUBRID_ASSOC)) {
printf("%-20s %-9s %-10s %-5s
",
$row["athlete"], $row["host_year"], $row["score"], $row["unit"]);
}
cubrid_close_request($history_req);
cubrid_disconnect($conn);
?>
The above example will output:
athlete host_year score unit
Phelps Michael 2004 51.25 time
SEE ALSO
cubrid_prepare(3), cubrid_bind(3), cubrid_next_result(3), cubrid_close_request(3), cubrid_commit(3), cubrid_rollback(3).
PHP Documentation Group CUBRID_EXECUTE(3)