12-04-2002
sql query variable not exactly unix
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 simple.
select * from price-file
where date between yesterday and today
I want yesterday and today to be a variable always set to system date and system date - 1
I know how to get the date in a unix script. How do I pass it to the sql and have it pick it up?
Newbie to sql..
thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I created a script to read a csv file with four columns. The script also saved values of each col in a arry.
In the script, i connected to db try to run a query to pull out data baisc on the values from the csv file.
select Num from tableName
where Sec_Num in ('${isin}') /*isin is an arry... (1 Reply)
Discussion started by: Sherry_Run
1 Replies
2. Shell Programming and Scripting
Hi,
My requirement is :
We are calling an sql statement from a UNIX session, and fetching data into some variables from a table .. now we are unable to access these variables from outside the SQL part. Please let me know how can I achieve this.
Can you please share a code snippet which... (4 Replies)
Discussion started by: venkatesh_sasi
4 Replies
3. Shell Programming and Scripting
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)
Discussion started by: krishna_gnv
1 Replies
4. Shell Programming and Scripting
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies
5. Shell Programming and Scripting
Hi
I am new in unix. oracle and unix are installed in my sytem.i need the script
which could connect to the oracle using username ,password and schema and can run the select * from tab query.
Thanks
vijay (8 Replies)
Discussion started by: vijays3
8 Replies
6. UNIX for Advanced & Expert Users
Hi Everyone,
Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below
i have defined two Hash %lc and %tab as below
$lc{'REFF'}='V_RES_CLASS';
$lc{'CALE'}='V_CAP_CLASS';
$lc{'XRPD'}='V_XFMR_CLASS';
$tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
Discussion started by: jam_prasanna
6 Replies
7. UNIX for Dummies Questions & Answers
Hi,
Could you please help me on this.
I have bulk of queries written in text file. I want to use those queries and want to execute from UNIX.
I don't want to run this file as a sql file as this file will change every week.
I want to run it in my environment as bulk sql statement from text... (1 Reply)
Discussion started by: abhii
1 Replies
8. Shell Programming and Scripting
I am running this test.ksh on server1. It successfully logins to server2 but runs the queries of query.sql on server1. query.sql is present in both server1 and server2
Can anybody please help.
I need to run queries on server2 itself.:confused:
Below is the test script... (10 Replies)
Discussion started by: shruthimithra
10 Replies
9. Shell Programming and Scripting
Hi,
I'm trying to asign to ksh varible some values of a sql query. The output query would be:
xxxx 1
yyyy 2
I do:
values=`$PATH_UTI/query_sh "
select think1||'------'||think2 from some_table
where think3 = '$1';
... (2 Replies)
Discussion started by: mierdatuti
2 Replies
10. Shell Programming and Scripting
Hi
iam new to shell scripting
how to declare variables as redshift query and I have to compare two counts by using if condition .
ex:count=select count(*) from prd;
select count(*) from prd;
select count(*) from tag;
can any one help me .
Please use CODE tags when displaying... (1 Reply)
Discussion started by: sam526
1 Replies
LEARN ABOUT PHP
mssql_next_result
MSSQL_NEXT_RESULT(3) MSSQL_NEXT_RESULT(3)
mssql_next_result - Move the internal result pointer to the next result
SYNOPSIS
bool mssql_next_result (resource $result_id)
DESCRIPTION
When sending more than one SQL statement to the server or executing a stored procedure with multiple results, it will cause the server to
return multiple result sets. This function will test for additional results available form the server. If an additional result set exists
it will free the existing result set and prepare to fetch the rows from the new result set.
PARAMETERS
o $result_id
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
RETURN VALUES
Returns TRUE if an additional result set was available or FALSE otherwise.
EXAMPLES
Example #1
mssql_next_result(3) example
<?php
// Connect to MSSQL and select the database
$link = mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php', $link);
// Send a query to MSSQL
$sql = 'SELECT [name], [age] FROM [php].[dbo].[persons]';
$query = mssql_query($sql, $link);
// Iterate through returned records
do {
while ($row = mssql_fetch_row($query)) {
// Handle record ...
}
} while (mssql_next_result($query));
// Clean up
mssql_free_result($query);
mssql_close($link);
?>
PHP Documentation Group MSSQL_NEXT_RESULT(3)