03-23-2010
it does not work .. can this be achieved without a pl sql block
and using just a select query and a linux variable .
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guyz,
Posting a thread after a long time.
I want to pass two variables to unix shell script from sql script.
Note: I am calling sql script from unix script. sql script has 2 variables one is the return code for status of program run and second one email flag. I don't know how to capture... (3 Replies)
Discussion started by: sachin.gangadha
3 Replies
2. Shell Programming and Scripting
Hello,
I need some help from the experts on PL/SQL and Shell scripting. I need a shell script that runs a PL/SQL procedure and gets the values returned from the PL/SQL procedure into the shell variables. The PL/SQL procedure returns multiple values.
I was able to assign a single return value... (1 Reply)
Discussion started by: Veera_Raghav
1 Replies
3. Shell Programming and Scripting
Hi guys,
I am quite new in shell scripting.
I am tring to promote some oracle jobs into control-M. In control-M, I am calling a script which establishes a connection with database and execute some procedures. Now I want if that PL/sql Block got failed script should return failure to... (2 Replies)
Discussion started by: alok1301
2 Replies
4. Shell Programming and Scripting
hi
i am calling a oracle stored procedure(in the database) from unix shell scripting (a.sh).
the called stored procedure returns some values through OUT variables
i want to assign the return values of stored procedure in to unix shell script variable.
can you provide me the code.
... (1 Reply)
Discussion started by: barani75
1 Replies
5. Shell Programming and Scripting
How could I call an Oracle PL/SQL procedure from any shell (bash) and catch returning value from that procedure (out param) or get a returning value if it's a function.
also, I got into trouble when I tried to send a number as a param
#!/bin/bash -e
username=$1
pwd=$2
baza=$3... (0 Replies)
Discussion started by: bongo
0 Replies
6. Shell Programming and Scripting
I've a script of the following form calling a simple sql that counts the no of rows as based on some conditions. I want the count returned by the sql to get assigned to the variable sql_ret_val1. However I'm finding that this var is always getting assigned a value of 0. I have verified by executing... (1 Reply)
Discussion started by: MxC
1 Replies
7. 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
8. Shell Programming and Scripting
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies
9. Shell Programming and Scripting
Hi All,
I need to return value to the main shell script, depending on whether the UPDATE command in the embedded pl/sql is successfu or not.
#!bin/ksh
updateStatus=`sqlplus --conn details-- << EOF
DECLARE
var_rows NUMBER;
BEGIN
update table_name
set column_name =... (7 Replies)
Discussion started by: rituparna_gupta
7 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have a script which send sql query to oracle db and return value to my script.
dummy code like below:
sqlplus -s user/${PASSWD}@${ORACLE_SID} @${DIR}/query.sql > outputfile
using above code, when query has error, it send error to same out put file and exit code is 0, is... (6 Replies)
Discussion started by: ken6503
6 Replies
LEARN ABOUT PHP
sqlsrv_query
SQLSRV_QUERY(3) SQLSRV_QUERY(3)
sqlsrv_query - Prepares and executes a query.
SYNOPSIS
mixed sqlsrv_query (resource $conn, string $sql, [array $params], [array $options])
DESCRIPTION
Prepares and executes a query.
PARAMETERS
o $conn
- A connection resource returned by sqlsrv_connect(3).
o $sql
- The string that defines the query to be prepared and executed.
o $params
- An array specifying parameter information when executing a parameterized query. Array elements can be any of the following:
oA literal value
oA PHP variable
oAn array with this structure: array($value [, $direction [, $phpType [, $sqlType]]])
The following table describes the elements in the array structure above:
Array structure
+----------------------+---------------------------------------------------+
| Element | |
| | |
| | Description |
| | |
+----------------------+---------------------------------------------------+
| $value | |
| | |
| | A literal value, a PHP variable, or a PHP by-ref- |
| | erence variable. |
| | |
|$direction (optional) | |
| | |
| | One of the following SQLSRV constants used to |
| | indicate the parameter direction: SQL- |
| | SRV_PARAM_IN, SQLSRV_PARAM_OUT, SQL- |
| | SRV_PARAM_INOUT. The default value is SQL- |
| | SRV_PARAM_IN. |
| | |
| $phpType (optional) | |
| | |
| | A SQLSRV_PHPTYPE_* constant that specifies PHP |
| | data type of the returned value. |
| | |
| $sqlType (optional) | |
| | |
| | A SQLSRV_SQLTYPE_* constant that specifies the |
| | SQL Server data type of the input value. |
| | |
+----------------------+---------------------------------------------------+
o $options
- An array specifing query property options. The supported keys are described in the following table:
Query Options
+-----------------------+--------------------------------------+---+
| Key | | |
| | | |
| | Values | |
| | | |
| | Description | |
| | | |
+-----------------------+--------------------------------------+---+
| QueryTimeout | | |
| | | |
| | A positive integer value. | |
| | | |
| | Sets the query timeout in seconds. | |
| | By default, the driver will wait | |
| | indefinitely for results. | |
| | | |
|SendStreamParamsAtExec | | |
| | | |
| | | |
| | TRUE or FALSE (the default is TRUE) | |
| | | |
| | Configures the driver to send all | |
| | stream data at execution ( TRUE), or | |
| | to send stream data in chunks ( | |
| | FALSE). By default, the value is set | |
| | to TRUE. For more information, see | |
| | sqlsrv_send_stream_data(3). | |
| | | |
| Scrollable | | |
| | | |
| | SQLSRV_CURSOR_FORWARD, SQLSRV_CUR- | |
| | SOR_STATIC, SQLSRV_CURSOR_DYNAMIC, | |
| | or SQLSRV_CURSOR_KEYSET | |
| | | |
| | See Specifying a Cursor Type and | |
| | Selecting Rows in the Microsoft SQL- | |
| | SRV documentation. | |
| | | |
+-----------------------+--------------------------------------+---+
RETURN VALUES
Returns a statement resource on success and FALSE if an error occurred.
EXAMPLES
Example #1
sqlsrv_query(3) example
<?php
$serverName = "serverNamesqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "INSERT INTO Table_1 (id, data) VALUES (?, ?)";
$params = array(1, "some data");
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
?>
NOTES
For statements that you plan to execute only once, use sqlsrv_query(3). If you intend to re-execute a statement with different parameter
values, use the combination of sqlsrv_prepare(3) and sqlsrv_execute(3).
SEE ALSO
sqlsrv_prepare(3), sqlsrv_execute(3).
PHP Documentation Group SQLSRV_QUERY(3)