Visit Our UNIX and Linux User Community


Reg DB values


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Reg DB values
# 1  
Old 06-26-2006
Reg DB values

Hi,

I would like to call my Data Base procedure through unix,
my procedure returns 4 values i.e. (4 out variables), how to assign 4 out variables to unix variables.

Ex:

xxat_safety_stock_main_p(
retcode => l_retcode
,errbuf => l_errbuf
,p_overwrite => l_overwrite
,p_disable => l_disable
,p_org_file => l_org_file
,p_fallout_file => l_fall_out_file
,p_path => l_outpath );

l_diable,l_org_file, l_fall_out_file, l_outpath variables are my out variables, I want to use the values returned by these variables into unix program .
thanx in advace.



Regards
Kiran Kumar
# 2  
Old 06-28-2006
What do you mean by unix program? C? bash? And how is this procedure being called, that's just as important.
# 3  
Old 06-28-2006
Try this

If you are using an oracle Database then you can use this. Or else you have to use the executable that could execute the peice where this peice of code uses "sqlplus".

The following code should be in your Unix shell script.

PARAMETERS=`sqlplus -s USERNAME/PASSWORD@db_instance << EOF
set space 0;
set pagesize 0;
set heading off;
set tab off;
set echo on;
set feedback off;
whenever sqlerror exit failure;

declare
l_disable <Datatype>;
l_org_file <Datatype>;
l_fallout_file <Datatype>;
l_outpath <Datatype>;

begin
xxat_safety_stock_main_p(retcode => l_retcode
,errbuf => l_errbuf
,p_overwrite => l_overwrite
,p_disable => l_disable
,p_org_file => l_org_file
,p_fallout_file => l_fall_out_file
,p_path => l_outpath );

DBMS_OUTPUT.PUT_LINE('DISABLE=' || l_disable || '-' || 'ORG_FILE=' || l_org_file || '-' || 'FALLOUT_FILE=' || l_fall_out_file || '-' || 'PATH=' || l_outpath);

end;
EOF`

if [ $? -ne 0 ]
then
echo "Error while getting parameters"
exit 1

else
# These are the parameters returned by the call to your database procedure
DISABLE=`echo $PARAMETER | cut -d "-" -f1 | cut -d "=" -f2`
ORG_FILE=`echo $PARAMETER | cut -d "-" -f2 | cut -d "=" -f2`
FALLOUT_FILE=`echo $PARAMETER | cut -d "-" -f3 | cut -d "=" -f2`
PATH=`echo $PARAMETER | cut -d "-" -f4 | cut -d "=" -f2`

fi

Previous Thread | Next Thread
Test Your Knowledge in Computers #608
Difficulty: Easy
Python does not need compilation to binary to run.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

REG Expression

Need your help in creating regular expression for particular set. let say I have given two dates 20130623 to 20140625. I need to create regular for the dates which fall in between above two dates. (4 Replies)
Discussion started by: gvkumar25
4 Replies

2. Shell Programming and Scripting

Reg expressions

Hi, I would like to grep for a string within a tag, can someone provide some assistance in how to do it? So I would like to use the grep command to find a string like: <tag>sometext<tag> because the sometext can be any number of characters or an type of number or lettering, what expression... (1 Reply)
Discussion started by: cyberfrog
1 Replies

3. Shell Programming and Scripting

Sorting - Reg.

Hi masters, I have one doubt, lets's say file1 has the following contents, 1 2.0 3.1 5.5 7 5.10 5.9 How to sort these contents to get the o/p like 1 2.0 3.1 5.5 5.9 5.10 7 (8 Replies)
Discussion started by: ecearund
8 Replies

4. Solaris

Reg: ZONES

HI Friends, What is the min. Requirement to install Solaris ZONEs, i am using INTEL PC at home and i allready installed Solaris 10 can i configure ZONES in it, and i want to know the basic information of ZONES. Thanks in Advance. (3 Replies)
Discussion started by: kurva
3 Replies

5. UNIX for Dummies Questions & Answers

Reg: MAILX

Hi all, I am trying to send a mail by using MAILX option to my YAHOO-Id. It is giving the following error. Can any one help me to find what is the problem? Do i need to get any kind of settings in my UNIX box for using MAILX? The bounce mail is as below: Message 1: From MAILER-DAEMON Tue... (2 Replies)
Discussion started by: Raamc
2 Replies

6. Shell Programming and Scripting

Reg expression For

HI system.sysUpTime.0 : Timeticks: (1519411311) 175 days, 20:35:13.11 From the above output i need only 175days in a perl script.. Please Help (2 Replies)
Discussion started by: Harikrishna
2 Replies

7. Shell Programming and Scripting

need a help reg -d in shell

hi, I am using this to get previous month `date -d"1 month ago" "+%m"` But will it work for january?..will it return 12? Please advice. (2 Replies)
Discussion started by: vanathi
2 Replies

8. UNIX for Dummies Questions & Answers

Help with Reg. Expression

I need help with this: Can any one tell me what does these below mean: 1. "\(.\).*") != '/' 2. sed 's+^\./++;s+/.*++' 3. sed "s+${f}/+ + Thanks in advance (7 Replies)
Discussion started by: moe2266
7 Replies

9. Shell Programming and Scripting

reg files

Dear all, One of our jobs retrieves data from tables and writes it to files. This job was running for around 15 minutes for the past 8 months. Now, this job is runnig for 45-50 minutes. I checked with the DBA's and found no issues with database. The time taken by to job to write to the file is... (5 Replies)
Discussion started by: ranj@chn
5 Replies

10. SCO

reg:rm -R is not working

I am installing the my package in SCO unix 5.0 .so it will create some temporary directories and files and same will delete.So , 'rm -R ' is not working in system .in the package only it has given this command,so now without this command working we can not go forward. so kindly help in this... (1 Reply)
Discussion started by: mokri_1980
1 Replies

Featured Tech Videos