Home » Infrastructure » Unix » Variable value passing between Unix shell - PL/SQL block
Variable value passing between Unix shell - PL/SQL block [message #98224] |
Fri, 14 May 2004 11:47  |
Pranav
Messages: 4 Registered: January 2002
|
Junior Member |
|
|
Hi,
I have following code snippet�where i am starting an SQL block from within shell script and intend to get a value back into shell script from SQL query. Issue is�I am unable to find a way to get the value (lv_base_storage) returned by SQL query back into shell domain for me to use that.
If any one has clue it will be appreciated.
Sample code:
---------------------------------------
get_database_values()
{
echo "Inside get_database_values..." >> ${LogFileName}
sqlplus -s $SQL_USER/$SQLPASSWD@$SQLHOST << EOSQL
SET SERVEROUTPUT ON
SET FEEDBACK OFF
SET VERIFY OFF
VARIABLE exit_status NUMBER
WHENEVER SQLERROR EXIT SQL.SQLCODE
DECLARE
�� lv_base_storage VARCHAR2(100);
�� ln_total_count NUMBER;
BEGIN
�� :exit_status := 0;
��
�� SELECT count(*)
���� INTO ln_total_count
���� FROM kl_clf_transcontrol;������
��
�� IF (ln_total_count > 0) THEN
����� BEGIN
� � � SELECT inivalue
���������� INTO lv_base_storage
�� ������� FROM kini
�� ������ WHERE inisection = 'Livelink.DocStorage;
�� EXCEPTION
�� � WHEN NO_DATA_FOUND THEN
���:exit_status := 1;
${LogFileName}
�� END;
�� ELSE
����� :exit_status := 1;
�� END IF;
END;
/
EXIT:exit_status
EOSQL
if [[ $? != "0" ]]
then
echo "Error in getting required database values. Quitting..." >> ${LogFileName}
�� exit 0
else
echo "Need the value of lv_base_storage here to proceed"
fi
}
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun May 04 19:48:18 CDT 2025
|