Sponsored Content
Top Forums Shell Programming and Scripting Executing sql statement from .sh file Post 302462093 by vbe on Wednesday 13th of October 2010 08:41:14 AM
Old 10-13-2010
Could you be more explicit?

---------- Post updated at 14:41 ---------- Previous update was at 14:35 ----------

I usually use this in my scripts calling .sql file:
Code:
sqlplus -silent $GO <<END
start $HOME/sqlscript
exit;
END

 

10 More Discussions You Might Find Interesting

1. HP-UX

SQL statement output to Log file-How?

Hi all, I need to bring the message to log file.Teradat/Hp-Ux script: ----- ### Update Log Table bteq <<- EOC .run file ${SRC_DATA}/logon.txt .run file ${SRC_DATA}/dbstagebteq.txt .set format off .set foldline off all .set sidetitles off ... (1 Reply)
Discussion started by: vsubbu1000
1 Replies

2. Shell Programming and Scripting

Executing Multiple .SQL Files from Single Shell Script file

Hi, Please help me out. I have around 700 sql files to execute in a defined order, how can i do it from shell script (3 Replies)
Discussion started by: anushilrai
3 Replies

3. Shell Programming and Scripting

Creating an sql statement from a file. Problem with '

Hi, I am trying to create sql statements from a file, but I have a problem with ': This is what I do: cat filex.txt | awk -F: '{print $1,"A","and personnavn like",$5}' | sed -e "s/^/select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like '/" -e "s/$/' and... (2 Replies)
Discussion started by: hannem
2 Replies

4. Shell Programming and Scripting

need some help in executing sql

i am stuck with a problem ... i have a shell script that gets the file name as input and performs the following operation... it runs through a for loop inside from which i connect to sqlplus and run a procedure that creates a number of tables .. there is no space in my server so we have made... (0 Replies)
Discussion started by: sais
0 Replies

5. Shell Programming and Scripting

Executing a Oracle SQL statement in a UNIX script

Hi All, I need to select one column from a table based upon the passed in parameter. I tried this: sqlplus -silent $MISP_USER << EOF set feedback off; set verify off; set sqlprompt "" SELECT mail_flag FROM dailyjobs WHERE job_name = '$1'; exit 0 EOF exit... (1 Reply)
Discussion started by: ganga.dharan
1 Replies

6. UNIX for Advanced & Expert Users

Bash executing Orcale Update statement

Hi All, Using Solaris box bash-3.00$ echo $BASH_VERSION 3.00.16(1)-release I have a real bummer of a bug, basically Im running a bash script that executes a bash function "dbase_sql". The bash function accepts a parameter in the form of an Oracle update statement eg ... (1 Reply)
Discussion started by: satnamx
1 Replies

7. UNIX for Advanced & Expert Users

Executing SQL file in UNIX

I have few .sql file at some location say /x/y/z. I want to execute those .sql files in UNIX server so that all packages,procedures can be applied on the database of the UNIX server. (1 Reply)
Discussion started by: Dip
1 Replies

8. Homework & Coursework Questions

Problem with executing a possible if or case statement script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a phonebook program. It should use functions to perform the required tasks. It should be menu-based,... (1 Reply)
Discussion started by: Rgasin02
1 Replies

9. Shell Programming and Scripting

Execute and log each statement/block SQL file

Hi friends, I would like to get some help on the following requirement. I have a SQL file with following things, select 1 from dual; select user from dual; select sysdate from dual; BEGIN PL/SQL Code END; / This file will be saved as sql file. When I run my expected shell script,... (1 Reply)
Discussion started by: ssnair
1 Replies

10. UNIX for Beginners Questions & Answers

Executing SQL's in parallel

Hi Folks, I have requirement to pull a bunch of SQL's from a table in DB and execute them in parallel and update the status of each query as and when they complete. Can you please help me with ideas on how this can be achieved? create table list_of_sql ( id number, full_sql... (3 Replies)
Discussion started by: member2014
3 Replies
DB2_NUM_FIELDS(3)							 1							 DB2_NUM_FIELDS(3)

db2_num_fields - Returns the number of fields contained in a result set

SYNOPSIS
int db2_num_fields (resource $stmt) DESCRIPTION
Returns the number of fields contained in a result set. This is most useful for handling the result sets returned by dynamically generated queries, or for result sets returned by stored procedures, where your application cannot otherwise know how to retrieve and use the results. PARAMETERS
o $stmt - A valid statement resource containing a result set. RETURN VALUES
Returns an integer value representing the number of fields in the result set associated with the specified statement resource. Returns FALSE if the statement resource is not a valid input value. EXAMPLES
Example #1 Retrieving the number of fields in a result set The following example demonstrates how to retrieve the number of fields returned in a result set. <?php $sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed"; $stmt = db2_prepare($conn, $sql); db2_execute($stmt, $sql); $columns = db2_num_fields($stmt); echo "There are {$columns} columns in the result set."; ?> The above example will output: There are 4 columns in the result set. SEE ALSO
db2_execute(3), db2_field_display_size(3), db2_field_name(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_NUM_FIELDS(3)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy