From a shell script i will conn to a oracle database and fetch few rows using a select statement.
Then i want to sort these rows and return a column (collection of values of a column from the selected results) as array back to the shellscript from which i conn to the database.
p.s. I don't want to redirect the result set into a file and use it
I prefer to use a co-process to give me maximum control over result sets. This is one method that should help you craft a solution that meets the requirement (as I read it):
Here are the results:
The co-process can be used over and over and stays active throughout your script's execution.
I'm attempting to populate an array in ksh using the following command:
set -A $(SELECT_INVOICE | sed '/^$/d')
SELECT_INVOICE is a function that executes the SQL query.
Problem: Some of the invoice numbers have alpha characters with spaces(example: OVEN MICRO). The Korn shell is treating... (1 Reply)
Hi friends,
I have to do the following things :
1) there should be a shell script returning the returning the return code of the script. and i have to add some more details like on which machine is has run , at what time and other details and then using plsql i have to add a row to Oracle... (3 Replies)
I am using the following code in my shell script
list=`sqlplus -s $user/$pwd@$dbms<<EOF
WHENEVER SQLERROR EXIT SQL.SQLCODE
set pagesize 0 feedback off verify off heading off echo off
select * from control_tbl
where src_nm=$3
and extrct_nm=$4;
exit SQL.SQLCODE;
EOF`
ERROR=$?... (1 Reply)
Hi,
Please can someone help to return the array elements from a function. Currently the problem I face is that tempValue stores the value in myValue as a string while I need an array of values to be returned instead of string.
Many Thanks,
Sudhakar
the function called is:
... (5 Replies)
Hi All,
I am using the following piece of script to print all the array elements in a script by name compare.sh:
31 len=${#array
};
32 j=0;
33 #echo "The length of the array is : $len"
34 while ; do
35 temp=${array}
36 echo "$temp"
37 let $j++
38 done
But I am getting the... (2 Replies)
Hi ,
i have written a shell scipt to call a procedure and get the value back from procedure.But i am facing the issue like
#!/bin/sh
returnedvalue=`sqlplus -s userid/pass<<EOF
set serveroutput on;
exec pass($1)
set serveroutput off;
EXIT;
EOF`
flag=`echo $returnedvalue `
echo "$flag"... (2 Replies)
Hi
I'm writing a shell script that connects to oracle database and fires query to check the availability of data in a table. In case of no data found then what will be the return code and how to handle in that in variable. Kindly provide with an example for better understanding... Thanks... (1 Reply)
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)
Example of problem:
computerhand=(6H 2C JC QS 9D 3H 8H 4D)
topcard=6D
How do you search ${computerhand} for all elements containing either a "6" or a "D" then
save the output to a file?
This is a part of a Terminal game of Crazy 8's that I'm attempting to write in Bash.
Any... (2 Replies)
Discussion started by: cogiz
2 Replies
LEARN ABOUT PHP
db2_special_columns
DB2_SPECIAL_COLUMNS(3) 1 DB2_SPECIAL_COLUMNS(3)db2_special_columns - Returns a result set listing the unique row identifier columns for a tableSYNOPSIS
resource db2_special_columns (resource $connection, string $qualifier, string $schema, string $table_name, int $scope)
DESCRIPTION
Returns a result set listing the unique row identifier columns for a table.
PARAMETERS
o $connection
- A valid connection to an IBM DB2, Cloudscape, or Apache Derby database.
o $qualifier
- A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string.
o $schema
- The schema which contains the tables.
o $table_name
- The name of the table.
o $scope
- Integer value representing the minimum duration for which the unique row identifier is valid. This can be one of the following
values:
+--------------+--------------------------------------+---+
|Integer value | | |
| | | |
| | SQL constant | |
| | | |
| | Description | |
| | | |
+--------------+--------------------------------------+---+
| 0 | | |
| | | |
| | SQL_SCOPE_CURROW | |
| | | |
| | Row identifier is valid only while | |
| | the cursor is positioned on the row. | |
| | | |
| 1 | | |
| | | |
| | SQL_SCOPE_TRANSACTION | |
| | | |
| | Row identifier is valid for the | |
| | duration of the transaction. | |
| | | |
| 2 | | |
| | | |
| | SQL_SCOPE_SESSION | |
| | | |
| | Row identifier is valid for the | |
| | duration of the connection. | |
| | | |
+--------------+--------------------------------------+---+
RETURN VALUES
Returns a statement resource with a result set containing rows with unique row identifier information for a table. The rows are composed
of the following columns:
+------------+---------------------------------------------------+
|Column name | |
| | |
| | Description |
| | |
+------------+---------------------------------------------------+
| SCOPE | |
| | |
| | |
| | |
| | box, tab (|); c | c | c | . T{ Integer |
| | value |
| | |
| | SQL constant |
| | |
| | Description |
| | |
+------------+---------------------------------------------------+
| 0 | |
| | |
| | SQL_SCOPE_CURROW |
| | |
| | Row identifier is valid only while the cursor is |
| | positioned on the row. |
| | |
| 1 | |
| | |
| | SQL_SCOPE_TRANSACTION |
| | |
| | Row identifier is valid for the duration of the |
| | transaction. |
| | |
| 2 | |
| | |
| | SQL_SCOPE_SESSION |
| | |
| | Row identifier is valid for the duration of the |
| | connection. |
| | |
+------------+---------------------------------------------------+
T} T{ COLUMN_NAME
T} |T{ Name of the unique column.
T} T{ DATA_TYPE
T} |T{ SQL data type for the column.
T} T{ TYPE_NAME
T} |T{ Character string representation of the SQL data type for the column.
T} T{ COLUMN_SIZE
T} |T{ An integer value representing the size of the column.
T} T{ BUFFER_LENGTH
T} |T{
Maximum number of bytes necessary to store data from this column.
T} T{ DECIMAL_DIGITS
T} |T{
The scale of the column, or NULL where scale is not applicable.
T} T{ NUM_PREC_RADIX
T} |T{
An integer value of either 10 (representing an exact numeric data type), 2 (representing an approximate numeric data type), or NULL (rep-
resenting a data type for which radix is not applicable).
T} T{ PSEUDO_COLUMN
T} |T{ Always returns 1.
T}
SEE ALSO db2_column_privileges(3), db2_columns(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_sta-
tistics(3), db2_table_privileges(3), db2_tables(3).
PHP Documentation Group DB2_SPECIAL_COLUMNS(3)