Home » Infrastructure » Unix » bash script <newbe>
bash script <newbe> [message #253873] Wed, 25 July 2007 03:22 Go to next message
xleigaj
Messages: 7
Registered: July 2007
Junior Member
Hi,

I've got problem with execute strored procedure using *.sh. The procedure needs parameters (file path). A parameter is not a parameter od *.sh script. These paths are from "ls -t -r" instruction. How send this file names to stored procedure using *.sh?

Re: bash script <newbe> [message #253889 is a reply to message #253873] Wed, 25 July 2007 04:17 Go to previous messageGo to next message
xleigaj
Messages: 7
Registered: July 2007
Junior Member
here is code of my script. It doesn't work. Now i need get value returns from a querry. I need this value in variable.

cd weryfikacja

ZMIENNA = NULL

sqlplus rms12dev/rms12dev <<EOF

SELECT COUNT(*) INTO '$ZMIENNA'  FROM Z_FS06XPRICE_VERIFY;

EOF
echo $ZMIENNA



Regards
Xleigaj

[Updated on: Wed, 25 July 2007 04:17]

Report message to a moderator

Re: bash script <newbe> [message #253892 is a reply to message #253889] Wed, 25 July 2007 04:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.orafaq.com/forum/mv/msg/85853/252792/102589/#msg_252792

Regards
Michel
Re: bash script <newbe> [message #254106 is a reply to message #253892] Wed, 25 July 2007 14:28 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
#!/bin/ksh
#======================================================
# stored proc with parms
#======================================================
## CREATE OR REPLACE PROCEDURE p1 (i_parm IN NUMBER, o_parm OUT NUMBER)
## IS
## BEGIN
##    o_parm := 5 * i_parm;
## END;
## /
my_in_parm=5
echo =============================
echo FIRST
echo =============================
RETVAL=`sqlplus -s scott/tiger@dev <<EOF
set serveroutput on
WHENEVER SQLERROR EXIT 1
declare
x number := $my_in_parm;
y number;
begin
p1(x, y);
dbms_output.put_line('o_parm from p1 is '||y);
end;
/
exit;
EOF`


#!/bin/ksh
sqlplus -s scott/tiger@dev <<EOF > tmp.txt
set pagesize 0 feedback off verify off heading off echo off
set serveroutput on
--select name from v\$parameter where name like 'nls%' and rownum <6;
select table_name from user_tables where rownum <6;
begin
  dbms_output.put_line('output parm#1');
  dbms_output.put_line('output parm#2');
end;
/
exit;
EOF

while read reslt_line
do
  echo "==>"$reslt_line
done < tmp.txt

==>BONUS
==>CUSTOMER
==>DATE_TAB
==>DEPT
==>DUMMY
==>output parm#1
==>output parm#2
Previous Topic: Need help with if statement
Next Topic: Passing parameters GC
Goto Forum:
  


Current Time: Sat Apr 20 06:29:51 CDT 2024