Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    11

    Question Unanswered: Parameter passing from PL*SQL to Unix shell script

    I am calling a PL*SQL from Unix shell script using 'sqlplus' command.

    While doing so I am also passing parameters to the PL*SQL.

    Is it possible to return a value from PL*SQL to the Unix shell script ?
    Regards,

    Ajay Patel

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    A possible solution (for oracle) :

    In your PL*SQL script (pl.sql):
    set serveroutput on
    BEGIN
    . . .
    dbms_output.put_line('RETURN_VALUE');
    . . .
    END

    In your shell :
    value=`sqlplus xx/xx @pl.sql`
    Jean-Pierre.

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1

    Smile

    The below script shows how to return values from PL/SQL block

    variable a_var number
    declare
    var1 number;
    begin
    UPDATE EMPLOYEE
    SET NAME = &1
    WHERE EMP_ID= '&2';
    var1 := SQL%ROWCOUNT;
    IF var1 >= 1 THEN
    :a_var := 0;
    ELSE
    :a_var := 1;
    END IF;
    end;
    /
    exit :a_var

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •