I have a stored procedure that takes 3 IN parameters and 1 OUT parameter.
Ist IN : 1 or 2
2nd IN : database schema
3rd IN : table name
4th OUT : returns message
call sp_test ('1', 'scott', 'emp', msg);
Working of SP is like if the first IN parameter is '1' it displays 5 top rows of a input table. ( This I have done using a dynamic sql and cursor with return only). And if the first IN parameter is '2' it deletes some particular rows of the input table.
Now, I want to call this procedure in shell script. and my questions are as below :
1) I want to handle the answer set in shell( which will be produced when I will pass 1st parameter as '1').
2) How to pass the IN parameter in shell.
3) How to handle the OUT parameter in shell.
As I dnt have any knowledge of shell any help with some piece of shell script will be appreciated.
Thanks in advance.
Below code will help you to acheive your requirement.
Thanks for the response that worked. Thanks a lot.
Need one more small help. I want to make the shell as menu based. I have written the below code but it is throwing me the error " run_test1.sh: syntax error at line 36 : `<' unmatched".
echo " ******** Task performing script ******** "
echo "1. task1 "
echo "2. task2 "
echo "3. EXIT"
echo -n "Please enter any option or options between [1 - 4]"
case $opt in
echo "Performing task1 . . . .";
echo "Performing task2 . . . .";
who | more;;
echo "Bye $USER";
echo "$opt is an invaild option";
echo "Press [enter] key to continue. . .";
Your help on this will be appreciated. :)
I don't think case stmnt supports here document in unix.
you can try below solution :
Vikas need your help once again.
I am exporting the of BTEQ into a file say file1.txt. Export is working fine.
Now, I want that the file.txt data get vanished every time when I run the bteq and it should have only the new data of export on every run.
Is there any such option for that?
Thanks in advance!
Put this line of code just prior to your bteq statement.
for example, if "/abc/efg/file.txt " is the file name with path.
then put this
Hope this helps.
I'm new to stored procedure in Teradata. Im trying to create a simple store procedure which would insert one record into table using unix script.
I'm unable to create as it is throwing error invalid sql statement.
Can you please tell me what mistake im doing.
create procedure p1()
insert into x values('abc');