Sponsored Content
Full Discussion: Store results in table
Top Forums Shell Programming and Scripting Store results in table Post 302775493 by Rami Reddy on Tuesday 5th of March 2013 01:39:30 AM
Old 03-05-2013
Linux Store results in table

Hello everyone,

I have a shell script, which connects to the database and runs .sql file.
after executing of .sql file, i need to store the results in error table.
How can i achieve this one? could you please give your suggestions.
here is my code.
Code:
#!/bin/sh
#set -vx

SCHEMA_NAME=$1
LOG="/db01/apps/applvis/VIS/apps/apps_st/appl/xxhex/12.0.0/sql/test1.log_rundate_`date +%Y%m%d`.`date +%H%M%S`"

echo ' '>>$LOG
echo 'start sqlplus .sql '>>$LOG
date >>$LOG

sqlplus apps/apps@VIS @/db01/apps/applvis/VIS/apps/apps_st/appl/xxhex/12.0.0/sql/test1.sql ${SCHEMA_NAME} 1>>$LOG

EXIT_CODE=$?
if [$EXIT_CODE = 0]
then 
   echo "Program successfull" >>$LOG
   echo '<<< End of program ' >>$LOG
   date >>$LOG
else
   echo "ERROR Program did not successfully execute " >> $LOG
   echo "EXIT CODE = $EXIT_CODE"
   date >>$LOG
   exit 1
fi
echo '  ' >>$LOG
echo 'end sqlplus .sql ' >>$LOG
echo '  ' >>$LOG

Thanks,
Rami Reddy
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

store awk results in a variable

I try to get the month (of last save) and the filename into a variable, is this possible ? something like this : for month in `ls -la | awk '{print $6}'` do if ] then a=filename of the matching file cp $a /Sep fi thanks, Steffen (1 Reply)
Discussion started by: forever_49ers
1 Replies

2. Shell Programming and Scripting

Grep results to store in a shell variable

I have the results of a grep with -n store in a shell variable ie VAR=`grep -n -e 'PATTERN' file` How ever I am missing the line breaks in the variable , How do I store the resualts of grep with many lines in to a variables. I want the varable should be the sawmway as we do the grep grep... (3 Replies)
Discussion started by: jojan
3 Replies

3. Shell Programming and Scripting

outputting data in table from grep results

Hi all. I'm a real unix newbie and looking for some help on a shell scripting problem. I'm going the longest ways around everything but I'm getting there. My next problem however has me stumped. I have set up a program that takes inputs from a user for a particular month and year (and stores them... (2 Replies)
Discussion started by: Chillspark
2 Replies

4. UNIX for Dummies Questions & Answers

store SQL statements and results in a file

Hello Guys... I want a small help from you guys. Actually in Oracle, we are having a utlity called spool through which can store whatever SQL statements executed and other queries and the output of those queries in a file So, similarly in Unix, if I start a session executing a number of Unix... (2 Replies)
Discussion started by: mraghunandanan
2 Replies

5. Shell Programming and Scripting

Not able to store the results of perl recursive function when applied under for loop

Hi Perl Gurus , need URGENT HELP PLEASE !!!!! I have one recursive Perl function which takes path of any directory as argument and returns array containing all the sub folders inside it recursively. Now the problem is that it works well if i use it with one time but the problem is that when... (0 Replies)
Discussion started by: anthriksh2000
0 Replies

6. Shell Programming and Scripting

Store data from dynamic website table

hi everybody, Asking for something that I´m not sure if it´s possible to implement. I hope be clear enough. Well, my issue is that I´m looking how to copy or extract a particular table content of a website. I get the content from a external feed (Iframe format), the content is updated every... (1 Reply)
Discussion started by: cgkmal
1 Replies

7. Shell Programming and Scripting

Script to store the variable in a table or array.

Hi, I have few variable say 10 ex:- l_pc_291334_01_0_01_00.cmp l_pc_441133_50_0_02_00.cmp l_pc_441133_55_0_02_00.cmp Each variable value is coming via loop on a table. I want to create a script that stores these value to a table or array ( But one by one not all at one time as... (4 Replies)
Discussion started by: amitkumar.b2
4 Replies

8. Shell Programming and Scripting

How to store results of ls in ftp?

Hi, I want to store the results of running ls in a directory on a remote host using ftp. For example, #!/usr/bin/ksh ftp -n hostx <<EOF user username password ls /tmp/RandomFiles.* #I need to put the results of that ls command into some file, so I can get the last file in... (3 Replies)
Discussion started by: mrskittles99
3 Replies

9. Shell Programming and Scripting

How to store results of multiple sql queries in shell variables in ksh?

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)
Discussion started by: gonchusirsa
6 Replies

10. UNIX for Dummies Questions & Answers

How to store "scp" results in a database table?

Hi, When I use scp to copy a file from other location, I get the output like filename, time taken etc on console. I want to store that into a database table (in oracle). Could someone give me some pointers on how to achieve this? Regards, Sachin Vaidya (1 Reply)
Discussion started by: notthatsachin
1 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:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy