Tuesday, June 4, 2013

Get the values from Value Set in Shell Script in R12

getPathInfo()
{
                sqlplus -s /nolog <<!!|grep -v 'Connected'
                connect ${FCP_LOGIN};
                SET HEADING OFF;
                SET FEEDBACK OFF;
                SET LINESIZE 3000;
                SET SERVEROUTPUT ON SIZE 1000000;
                BEGIN
                DECLARE
                         value1                VARCHAR2(250) := '';
                         value2                VARCHAR2(250) := '';
                         BEGIN
                             BEGIN
                                   SELECT '10','20'
                                   INTO    value1 ,value2
                                   FROM dual;
                             EXCEPTION
                                  WHEN NO_DATA_FOUND  THEN
                                        DBMS_OUTPUT.PUT_LINE('NO_DATA_FOUND');
                                  WHEN OTHERS THEN
                                        DBMS_OUTPUT.PUT_LINE('ERROR');
                             END;

                              DBMS_OUTPUT.PUT_LINE(value1||'#'||value2);
                     END;
                END;
/
!!
}
value=`getPathInfo`
x=`echo "$value"|cut -d# -f1`
y=`echo "$value"|cut -d# -f2`
echo "x : $x“
echo "y : $y“ 

Output :

x : 10
y : 20

Note : change the select query to fetch the valueset values

No comments:

Post a Comment

Price List Query for Item

 SELECT qph.list_header_id,        qph.name,        qph.description,        qphh.start_date_active,        qphh.currency_code,        q...