I know htis isnt exactly unix.... but hopefully someone can help me or direct me someplace to get help.
I can run sql queries in scripts against my informix db using:
dbaccess mydb myquery.sql >> sql.output
I need to write my script to select based on todays date. Its very... (5 Replies)
Hi Guys !
I am new to unix and want to find out how we can make sql statement data to shell script variable?
Any help/suggestion is greatly appreciated
-Chandra (1 Reply)
Hi,
My requirement is :
We are calling an sql statement from a UNIX session, and fetching data into some variables from a table .. now we are unable to access these variables from outside the SQL part. Please let me know how can I achieve this.
Can you please share a code snippet which... (4 Replies)
i have to do a check in my UNIX script to see whats saved in the database. depending on whats there will fork data to certain functions. However i do not know how to capture SQL output into a UNIX variable.
Below is what i have tried, but i get an error:
Error 3706 Failure 3706 Syntax error:... (3 Replies)
I am trying to assgn the output of the select statement to a variable, like this
"VARIABLE_NAME=$ db2 "select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK'"; "
but the value that is getting into VARIABLE_NAME is
"COLUMN_NAME_1
-----------------
VALUE
1... (3 Replies)
Hi
I tried searching but I used to see , this has been answered may times.
But I could not find.
I am looking a SQLPLUS output to be assigned to shell variable.
This is what I coded.
##/bin/ksh
sqlplus dmishr/mishra#09@ps004d.world <<ENDOFSQL
spool abc.log
SET ECHO OFF NEWP... (4 Replies)
Hi All
I have a requirement where in I am stuck. There is a shell script that is being developed by me. It consist of the sql stmt also. I need to export a variable called HOMEPAGE with a value say www.abc.com. and then use this $HOMEPAGE variable in the sql stmt. My ultimate aim is to fetch all... (1 Reply)
Hi,
I have a requirement to store oracle sqlplus output to some unix variable, count the records and then print the output on the screen.
Can you please point me to any sample program for reference purpose.
Thanks a lot for your time. (0 Replies)
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)
Hi
iam new to shell scripting
how to declare variables as redshift query and I have to compare two counts by using if condition .
ex:count=select count(*) from prd;
select count(*) from prd;
select count(*) from tag;
can any one help me .
Please use CODE tags when displaying... (1 Reply)
Discussion started by: sam526
1 Replies
LEARN ABOUT PHP
cubrid_prepare
CUBRID_PREPARE(3) 1 CUBRID_PREPARE(3)cubrid_prepare - Prepare a SQL statement for executionSYNOPSIS
resource cubrid_prepare (resource $conn_identifier, string $prepare_stmt, [int $option])
DESCRIPTION
The cubrid_prepare(3) function is a sort of API which represents SQL statements compiled previously to a given connection handle. This
pre-compiled SQL statement will be included in the cubrid_prepare(3).
Accordingly, you can use this statement effectively to execute several times repeatedly or to process long data. Only a single statement
can be used and a parameter may put a question mark (?) to appropriate area in the SQL statement. Add a parameter when you bind a value in
the VALUES clause of INSERT statement or in the WHERE clause. Note that it is allowed to bind a value to a MARK(?) by using the
cubrid_bind(3) function only.
PARAMETERS
o $conn_identifier
-Connection identifier.
o $prepare_stmt
-Prepare query.
o $option
-OID return option CUBRID_INCLUDE_OID.
RETURN VALUES
Request identifier, if process is successful;
FALSE, if process is unsuccessful.
EXAMPLES
Example #1
cubrid_prepare(3) example
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$sql = <<<EOD
SELECT g.event_code, e.name
FROM game g
JOIN event e ON g.event_code=e.code
WHERE host_year = ? AND event_code NOT IN (SELECT event_code FROM game WHERE host_year=?) GROUP BY event_code;
EOD;
$req = cubrid_prepare($conn, $sql);
cubrid_bind($req, 1, 2004);
cubrid_bind($req, 2, 2000);
cubrid_execute($req);
$row_num = cubrid_num_rows($req);
printf("There are %d event that exits in 2004 olympic but not in 2000. For example:
", $row_num);
printf("%-15s %s
", "Event_code", "Event_name");
printf("----------------------------
");
$row = cubrid_fetch_assoc($req);
printf("%-15d %s
", $row["event_code"], $row["name"]);
$row = cubrid_fetch_assoc($req);
printf("%-15d %s
", $row["event_code"], $row["name"]);
cubrid_disconnect($conn);
?>
The above example will output:
There are 27 event that exits in 2004 olympic but not in 2000. For example:
Event_code Event_name
----------------------------
20063 +91kg
20070 64kg
SEE ALSO cubrid_execute(3), cubrid_bind(3).
PHP Documentation Group CUBRID_PREPARE(3)