---------- Post updated at 01:21 PM ---------- Previous update was at 01:07 PM ----------
This parameter file will be used by above script to trigger this queries. While i am executing the query output is not being assigned to Array variables. Please help me with this..
Last edited by Franklin52; 08-16-2013 at 04:58 AM..
Reason: Please use code tags
Hi,
When i execute the below statement , the value is not getting stored in the variable.
AnneeExercice=`sqlplus $LOGSQL/$PASSWORDSQL << FIN >> $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc
SELECT bi09exercice
FROM bi09_scenario
WHERE bi09idfiliale=UPPER('de')
AND ... (1 Reply)
Hi All,
I need some help with arrays. I need to take input from the user for hostname, username and password until he enters .(dot) or any other character and store the values in the variable array.
I would further connect to the hostname using username and passwd and copy files from server to... (7 Replies)
hi
this is an example of code:
use strict;
use warnings;
open FILE, "/tmp/result_2";
my $regex="\\ Starting program ver. (.*)";
my $res="Program started, version <$1> - OK.\n";
while (<FILE>) {
if ($_ =~ /($regex)/) {
print "$res";
}
}
close FILE;
This finds $regex and print... (3 Replies)
Hello
Apologies for not having the most accurate of thread titles.. I'm using IBM Rational Synergy CM software. I use the Synergy commands in tandem with Unix commands.
I have a directory containing source code objects:
bash-3.00$ ccm ls *.fmb *.rdf *.pll *.mmb
cre_applications.fmb-1... (1 Reply)
I need to know how to store output from one command so that it can initiate another command.
chktraf -s | cut -c1-4
output would look like
321
142
256
342
123
Then if the value of the output = 0, then initiate next command.
if
then
for xx in 01 02 03 04 05 06 07 08 09 10
do
... (4 Replies)
While assisting a forum member, I recommended running SQL/Plus in a coprocess (to make database connections and run a test script) for the duration of his script rather than starting/stopping it once for every row in a file he was processing.
I recalled I made a coprocess example for folks at... (2 Replies)
Hi,
I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else.
Thanks in advance..
Cheers (6 Replies)
Hi,
I am new to linux...
How to Assign SQL Query Results to Variables in Linux,i want ti generate it in param files, Can anyone please explain me.
Ex: SQL> Select * from EMP;
O/P: Emp_No Emp_Name
1 AAA
2 BBB
3 CCC
and I want expected... (5 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)
Discussion started by: Rokkesh
3 Replies
LEARN ABOUT PHP
sqlsrv_prepare
SQLSRV_PREPARE(3)SQLSRV_PREPARE(3)sqlsrv_prepare - Prepares a query for executionSYNOPSIS
mixed sqlsrv_prepare (resource $conn, string $sql, [array $params], [array $options])
DESCRIPTION
Prepares a query for execution. This function is ideal for preparing a query that will be executed multiple times with different parameter
values.
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_prepare(3) example
This example demonstrates how to prepare a statement with sqlsrv_prepare(3) and re-execute it multiple times (with different param-
eter values) using sqlsrv_execute(3).
<?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 = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// Variables $qty and $id are bound to the statement, $stmt.
$qty = 0; $id = 0;
$stmt = sqlsrv_prepare( $conn, $sql, array( &$qty, &$id));
if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// This array maps the order ID to order quantity in key=>value pairs.
$orders = array( 1=>10, 2=>20, 3=>30);
// Execute the statement for each order.
foreach( $orders as $id => $qty) {
// Because $id and $qty are bound to $stmt1, their updated
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
NOTES
When you prepare a statement that uses variables as parameters, the variables are bound to the statement. This means that if you update
the values of the variables, the next time you execute the statement it will run with updated parameter values. For statements that you
plan to execute only once, use sqlsrv_query(3).
SEE ALSO sqlsrv_execute(3), sqlsrv_query(3).
PHP Documentation Group SQLSRV_PREPARE(3)