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,
I have a unix varaible called as account which hold values which i want to use in a PL/SQL block in a shell script.
This variable value is being used in multiple places in the PL/SQL block and i get an erroe whenenevr is use this varaible with $prompt.
Help Urgently (1 Reply)
hi All
Please explain the below statement in RED?What does this mean?
perl /HDS/common/operations/Quality_Team/Nirvana/WEEKLY_OOPS/sql_dump.pl --sql "select * from WEEKLY_REPORT order by test_case, type" --username=ddb_qa --password=ddb_qa123 --sid=pldeldb --output... (1 Reply)
Hi Guys,
I am trying to pass a string variable from Unix shell script to sqlplus as a parameter.
I have tried using single quotes with the variable name but it does not work. Please help me with it.
I am using BASH.
My code:
Your help is much appreciated.
Thanks,
shil (2 Replies)
my code does somthing like this:
#!bin/ksh
sqlplus / | While read id
do
temp=`echo $id`
i = i+1
done
j=0
while
do
--connecting to sql and executing a Stored proc for 1st id
--checking for the status
status = $?
if
error
--need to... (1 Reply)
The following is my script :
#!/bin/bash
echo "please give app_instance_id"
read app_instance_id
echo "id is $app_instance_id"
export app_id=app_instance_id
sqlplus -s nnviewer/lookup@//nasolora008.enterprisenet.org:1521/LOAD3 @test.sql<<EOF
SPOOL /home/tibco/MCH/Data/qa/raak/name.xls... (4 Replies)
I have a sql statement , i need to assign to a variable in Unix
sel count(*) AS num_files from TABLE_A;
i need to use "num_files" in unix statements. let me know how to assign unix variable to above num_files (1 Reply)
Hi
I am new to UNIX. I am trying the below and getting the error.
I am trying to assign the variable with the value of the query result. I want this value to use in the next steps.
Created UNIX file (Batch.sh) as below
#!/bin/ksh
sqlplus callidus/callidus4u@attstcal @Batch.sql
... (2 Replies)
Discussion started by: KrishBalu
2 Replies
LEARN ABOUT PHP
sqlsrv_fetch_array
SQLSRV_FETCH_ARRAY(3)SQLSRV_FETCH_ARRAY(3)sqlsrv_fetch_array - Returns a row as an arraySYNOPSIS
array sqlsrv_fetch_array (resource $stmt, [int $fetchType], [int $row], [int $offset])
DESCRIPTION
Returns the next available row of data as an associative array, a numeric array, or both (the default).
PARAMETERS
o $stmt
- A statement resource returned by sqlsrv_query or sqlsrv_prepare.
o $fetchType
- A predefined constant specifying the type of array to return. Possible values are SQLSRV_FETCH_ASSOC, SQLSRV_FETCH_NUMERIC, and
SQLSRV_FETCH_BOTH (the default). A fetch type of SQLSRV_FETCH_ASSOC should not be used when consuming a result set with multiple
columns of the same name.
o $row
- Specifies the row to access in a result set that uses a scrollable cursor. Possible values are SQLSRV_SCROLL_NEXT, SQL-
SRV_SCROLL_PRIOR, SQLSRV_SCROLL_FIRST, SQLSRV_SCROLL_LAST, SQLSRV_SCROLL_ABSOLUTE and, SQLSRV_SCROLL_RELATIVE (the default). When
this parameter is specified, the $fetchType must be explicitly defined.
o $offset
- Specifies the row to be accessed if the row parameter is set to SQLSRV_SCROLL_ABSOLUTE or SQLSRV_SCROLL_RELATIVE. Note that the
first row in a result set has index 0.
RETURN VALUES
Returns an array on success, NULL if there are no more rows to return, and FALSE if an error occurs.
EXAMPLES
Example #1
Retrieving an associative array.
<?php
$serverName = "serverNameinstanceName";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT FirstName, LastName FROM SomeTable";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo $row['LastName'].", ".$row['FirstName']."<br />";
}
sqlsrv_free_stmt( $stmt);
?>
Example #2
Retrieving a numeric array.
<?php
$serverName = "serverNameinstanceName";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT FirstName, LastName FROM SomeTable";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
echo $row[0].", ".$row[1]."<br />";
}
sqlsrv_free_stmt( $stmt);
?>
NOTES
Not specifying the $fetchType or explicity using the SQLSRV_FETCH_TYPE constant in the examples above will return an array that has both
associative and numeric keys.
If more than one column is returned with the same name, the last column will take precedence. To avoid field name collisions, use aliases.
If a column with no name is returned, the associative key for the array element will be an empty string ("").
SEE ALSO sqlsrv_connect(3), sqlsrv_query(3), sqlsrv_errors(3), sqlsrv_fetch(3).
PHP Documentation Group SQLSRV_FETCH_ARRAY(3)