Sponsored Content
Full Discussion: Using a variable in sqlplus
Top Forums Shell Programming and Scripting Using a variable in sqlplus Post 302090431 by MadHatter on Monday 25th of September 2006 03:14:49 PM
Old 09-25-2006
Anyone know how I would be able to output the results to a txt file where it would include the variable from the list file next to its result?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass variable to SQLPLUS in a ksh script?

Hi, I am writing a ksh script which will use sqlplus to run a sql and pass 2 variables as the SQL request. In the ksh script, I have 2 variables which are $min_snap and $max_snap holding 2 different numbers. Inside the same script, I am using SQLPLUS to run an Oracle SQL script,... (6 Replies)
Discussion started by: rwunwla
6 Replies

2. UNIX for Advanced & Expert Users

How to pass unix variable to SQLPLUS

hi fellows, can any body tell me how to pass unix variables to oracle code is... #! /bin/ksh echo ENTER DATE VALUE's read START_DATE END_DATE sqlplus xyx/abc@oracle select * from table1 where coloumn1 between $START_DATE and $END_DATE; is this is correct way........... Thanks in... (1 Reply)
Discussion started by: chiru
1 Replies

3. Shell Programming and Scripting

Passing the unix variable to sqlplus

Hi, I am writing a script which creates an external table using a shell script. My requirement is like this. Usage: . ./r.ksh <table_name> - this should create an external table. e.g . ./r.ksh abc - this should create an external table as abc_external. How do i achieve this? Please... (5 Replies)
Discussion started by: Anaramkris
5 Replies

4. Shell Programming and Scripting

store sqlplus output in variable

hi how can i store sqlplus output to a variable in sh script (not bash) Thanks MM (1 Reply)
Discussion started by: murtymvvs
1 Replies

5. Shell Programming and Scripting

Sending sqlplus output to a shell variable

I am trying to import a sqlplus output into a shell variable but it doesnt seem to be working. set -x export DEPENDENT_CR_NO=`sqlplus -s /nolog <<EOF conn username/passwd set heading off select dependency from custom_patches where patch_name='PATCH.zip'; exit; EOF` echo $DEPENDENT_CR_NO ... (2 Replies)
Discussion started by: beginer314
2 Replies

6. Shell Programming and Scripting

awk with variable from sqlplus

Hi, I'm a it stuck on the below code where a variable is pulled from sqlplus and used in awk. It runs with no errors but still pulls back all records in the input file. It should pull the max reference from sql plus and then only print those records where the reference value in column 1 is... (4 Replies)
Discussion started by: jonathanb30
4 Replies

7. Shell Programming and Scripting

Scirpt to fetch the variable from sqlplus

Hi Gurus, I am stuck with the step where i need to fetch the location & sales from the below procedure by taking it from table field using the for loop. any idea how this can be done in unix. From one column both the location and sales are taken out. create or replace procedure newyork... (2 Replies)
Discussion started by: arun888
2 Replies

8. Shell Programming and Scripting

Passing sqlplus output to shell variable

Hi , I am using below code : for i in `ps -ef|grep pmon|awk {' print $8 '}|cut -f3 -d'_'|grep -v '^grep'` do ORACLE_SID=$i export ORACLE_SID; dest=`sqlplus "/ as sysdba" <<EOF set heading off feedback on verify off select DESTINATION from v\\$archive_dest where target in... (5 Replies)
Discussion started by: admin_db
5 Replies

9. UNIX for Beginners Questions & Answers

Sqlplus variable UNIX

hi guys i have a sqlplus : sqlplus -s username/password << EOF @mysql.sql EOF in mysql.sql there is a count of a table, i want to write in a variabile unix. how can i do? Thanks a lot Regards Francesco. (3 Replies)
Discussion started by: Francesco_IT
3 Replies

10. Shell Programming and Scripting

Pass a VARIABLE to sqlplus script

Hi Team, I am trying to run a sqlplus script against several databases via a FOR/LOOP and also passing the loop variable to a sqlplus script I am calling, as follows: #!/bin/bash export ORACLE_SID=plgc1 export ORACLE_HOME=/opt/oracle/product/11.2.0.2/db_1 export... (1 Reply)
Discussion started by: jonnyd
1 Replies
SQLSRV_FIELD_METADATA(3)												  SQLSRV_FIELD_METADATA(3)

sqlsrv_field_metadata - Retrieves metadata for the fields of a statement prepared bysqlsrv_prepare(3)orsqlsrv_query(3)

SYNOPSIS
mixed sqlsrv_field_metadata (resource $stmt) DESCRIPTION
Retrieves metadata for the fields of a statement prepared by sqlsrv_prepare(3) or sqlsrv_query(3). sqlsrv_field_metadata(3) can be called on a statement before or after statement execution. PARAMETERS
o $stmt - The statment resource for which metadata is returned. RETURN VALUES
Returns an array of arrays is returned on success. Otherwise, FALSE is returned. Each returned array is described by the following table: Array returned by sqlsrv_field_metadata +----------+---------------------------------------------------+ | Key | | | | | | | Description | | | | +----------+---------------------------------------------------+ | Name | | | | | | | The name of the field. | | | | | Type | | | | | | | The numeric value for the SQL type. | | | | | Size | | | | | | | The number of characters for fields of character | | | type, the number of bytes for fields of binary | | | type, or NULL for other types. | | | | |Precision | | | | | | | The precision for types of variable precision, | | | NULL for other types. | | | | | Scale | | | | | | | The scale for types of variable scale, NULL for | | | other types. | | | | |Nullable | | | | | | | An enumeration indicating whether the column is | | | nullable, not nullable, or if it is not known. | | | | +----------+---------------------------------------------------+ For more information, see sqlsrv_field_metadata in the Microsoft SQLSRV documentation. EXAMPLES
Example #1 sqlsrv_field_metadata(3) example <?php $serverName = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"AdventureWorks", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT * FROM Table_1"; $stmt = sqlsrv_prepare( $conn, $sql ); foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) { foreach( $fieldMetadata as $name => $value) { echo "$name: $value<br />"; } echo "<br />"; } ?> SEE ALSO
sqlsrv_client_info(3). PHP Documentation Group SQLSRV_FIELD_METADATA(3)
All times are GMT -4. The time now is 01:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy