12-09-2011
Here we are specifying "sql query" in the script itself ..if it is a small we can accommodate here
Requirements:
We have multiple tables of same format to unload:-
so we want to modify the query often without changing the code (script)i.e without disturbing the code only just modify the sql query in a file.
Sql query=stored in a file and call that file in the script to execute the query
Thanks and welcome for your ideas
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file with userIDs, one per line no spaces. I have a script that accepts userIDs as a parameter and outputs information about them. What I have had to do in the past was to modify each line of the file with userIDs to call the script with the userID and pipe the output to a data file.
... (2 Replies)
Discussion started by: vmaxx
2 Replies
2. Shell Programming and Scripting
Hi All,
I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field. Could any one please help me in connecting database tables using Unix and retriving data from the same.
Thanks,
Durwas (0 Replies)
Discussion started by: dtidke
0 Replies
3. Shell Programming and Scripting
Hi....can you guys help me out in this script??
Below is a portion text file and it contains these:
GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001... (1 Reply)
Discussion started by: pallavishetty
1 Replies
4. Shell Programming and Scripting
I need to pass a variable as a parameter from shell script into a DB2 database.
var=bhuk_1123_Q_11/22/09
select * from tbl1 where serial_id='$var';
I have tried executing it using
db2 -tvf scriptname
Somebody please help me out with this. It is throwing an error. Please tell me how... (2 Replies)
Discussion started by: ss3944
2 Replies
5. Shell Programming and Scripting
Can anyone please help me with an unix shell script to connect a DB2 database. My requirement is just to display the no of records present in a table of a DB2 database through Unix Shell script. Thx - Ram (1 Reply)
Discussion started by: onlyraja
1 Replies
6. Shell Programming and Scripting
Hi All,
I have written a shell script to compile an oracle R12 form and also a procedure is called from it. The procedure registers the form, function and creates a menu entry.
I took directory as a parameter. Code is as below:
#!/bin/ksh
echo... (3 Replies)
Discussion started by: veena484
3 Replies
7. Shell Programming and Scripting
Hi All,
I need urgent Help from all of you here.
Below is my code-
==================================================
#!/usr/bin/sh
cd $1
cat $2 | tr -ds "$" "" > parameter_file.param
export `parameter_file.param`
chmod 777 parameter_file.param
echo $1
echo $2
cd $prmDirInput... (5 Replies)
Discussion started by: Amit786
5 Replies
8. Shell Programming and Scripting
Hi,
I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below...
if (start_new_rec=="true"){
exclude_user="false";
user=toupper($6);
match(user, "XXXXX.");
if (RSTART ==2 ) {
... (9 Replies)
Discussion started by: asandy1234
9 Replies
9. Shell Programming and Scripting
Team
I have files in different directories . How can i take the count of latest file and insert into Db2 table .
I am using
awk 'END{print NR+1-ARGC}' (File name)
to get the counts.
How can i take
1.The count of latest file
2.Insert into Db2 table( File Name and Counts) .
cd... (4 Replies)
Discussion started by: Perlbaby
4 Replies
10. UNIX for Beginners Questions & Answers
HI Team,
I am working on reading hive table and send email in email body using shell script, can you please help on fixing the errors: I have 6 columns in my hive table and trying to send the email in the mail body.
below script:
#!/bin/bash
hive -e 'SELECT count(*) from db.table' >... (4 Replies)
Discussion started by: Mi4304
4 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)