The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to restore original package after uninstalling the upgraded package using rpm amitpansuria Linux 0 05-27-2008 04:08 AM
Passing a unix variable value to a Plsql function cobroraj UNIX for Advanced & Expert Users 1 10-30-2007 06:59 AM
calling plsql function in a unix script cobroraj UNIX for Advanced & Expert Users 2 10-29-2007 11:06 PM
Shell - PLSQL multiple process problem. deepsweech Shell Programming and Scripting 1 07-25-2007 05:28 AM
Sending mails using plsql program amol_mudholkar IP Networking 5 09-27-2006 09:16 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-09-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Receiving Value from plsql package.

Hi,

I am working on a shell script that fires a plsql package. I would like the package to return a value to the shell script and then the shell script to return it to the javascript. Is it possible for the shell script to accept the return status from the plsql package and then pass it back to the calling java script? The call to the package from the shell script looks like:

echo "=== Calling the processing procedure..."
sqlplus hotman/hotman > /dev/null << EOF
begin
pho_glovia_pkg.move_data_prc('$r_status');
end;
/
EOF

When I run it like this it won't call the package, but if I go to the package and remove the return parameter and remove the "('$r_status')" from the shell script it runs just fine.

Thanks,

Amber Taylor
  #2 (permalink)  
Old 11-12-2001
edog edog is offline
Registered User
  
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
if you are just trying to grab the exit code is is returned to the shell script and can be accessed in the $? variable. If the value is something else but still an integer, have your package exit with the value you want to grab. exit myvalue this will cause the shell to think that myvalue is the return code and it can be accessed in $? not sure if this is what you wanted but hope it helps. I have found that working with a function is easiest that way all you need to do is

value = `sqlplus hotman/hotman << EOF
begin
pho_glovia_pkg.move_data_prc();
end;
/
EOF`

the value returned by the function will be in $value
  #3 (permalink)  
Old 11-14-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Thanks for your advice. I was attempting to reuse code :-) that existed in a package. This package normally returns a status and I was trying to pick up that status from the package using a shell script and return it to the java. As a workaround I created a transaction/error table that the java can query after execution of the shell script to find the status of a run. The shell script inserts any errors during the file loads and the package will make the insert on exit for any errors found during the run. This way I can return multiple errors when needed.

Thanks,

Amber Taylor
  #4 (permalink)  
Old 11-14-2001
rwb1959's Avatar
rwb1959 rwb1959 is offline
Registered User
  
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Hi Amber,

You should be able to do somthing like...

#!/usr/bin/ksh

sqlplus -s scott/tiger@db << EOF > /tmp/result.$$
declare invar number;
declare outvar char(30);
exec myschema.mypkg.myproc(invar, outvar);
dbms_output.putline(outvar);
/
EOF

read result /tmp/result.$$
echo $result
rm -f /tmp/result.$$
exit 0

...if you do a search on the forum from "sqlplus" you should
see lots of good examples. The one above is just a quick and dirty
one.
  #5 (permalink)  
Old 11-14-2001
akpopa akpopa is offline
Registered User
  
 

Join Date: Aug 2001
Location: South Carolina
Posts: 18
Thanks!

Amber Taylor
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0