Catch a value from a pl*sql function in a shell script

Hi all,
I have a shell script that simply calls the following pl*sql function.
echo "execute scott.my_pkg.test('FDLmaster');\n exit;" >./pippo.sql
sqlplus scott/tiger @/fidcap_ftp/FDL/SCRIPTS/pippo.sql
What I have to do to catch the value returned from the function test?
Thanks in advance
best regards
Mario

SQL> create or replace function do_something return varchar2 is
  2  begin
  3      return ('Something');
  4* end;
SQL> /
Function created.
SQL> select do_something from dual;
DO_SOMETHING
Something
SQL> save pippo
Created file pippo.sql
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
[linuxas tmp test10]$ echo exit >>pippo.sql
[linuxas tmp test10]$ VAR=`sqlplus -s scott/tiger @pippo`
[linuxas tmp test10]$ echo $VAR | cut -f3 -d" "
Something
[linuxas tmp test10]$

Similar Messages

  • Pass a value from a PL/SQL function to a javascript (html header) ? ?

    Hey Guys,
    Have a question regarding how to pass a value from a PL/SQL function to a javascript in the HTML Header.
    I have created a PL/SQL function in my database, which does looping.
    The reason for this is:  On my apex page when the user selects a code, it should display(or highlight buttons) the different project id's present for that particular code.
    example= code 1
    has project id's = 5, 6, 7
    code 2
    has project id's = 7,8
    Thank you for your Help or Suggestions
    Jesh
    The PL/SQL function :
    CREATE OR REPLACE FUNCTION contact_details(ACT_CODE1 IN NUMBER) RETURN VARCHAR2 IS
    Project_codes varchar2(10);
    CURSOR contact_cur IS
    SELECT ACT_CODE,PROJECT_ID
    FROM ACTASQ.ASQ_CONTACT where ACT_CODE = ACT_CODE1;
    currec contact_cur%rowtype;
    NAME: contact_details
    PURPOSE:
    REVISIONS:
    Ver Date Author Description
    1.0 6/25/2009 1. Created this function.
    BEGIN
    FOR currec in contact_cur LOOP
         dbms_output.put_line(currec.PROJECT_ID || '|');
         Project_codes := currec.PROJECT_ID|| '|' ||Project_codes;
    END LOOP;
    RETURN Project_codes;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END contact_details;
    /

    Jesh:
    I have made the following modifications to your app to get it to work as I thing you need it to.
    1) Changed the source for the HTML Buttons Region(note use of id vs name for the Buttons)
    <script>
    function hilitebtn(val) {
    //gray buttons
    $x('graduate').style.backgroundColor='gray'
    $x('distance').style.backgroundColor='gray'
    $x('career').style.backgroundColor='gray'
    $x('photo').style.backgroundColor='gray'
    //AJAX call to get project-ids
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=GETPROJECTS',0);
    get.addParam('x01',val)
    gReturn = get.get();
    var arr=gReturn.split(':');  //dump into array
    get = null;
    for (i=0;i<arr.length;i++) {
    // alert('val=' + arr);
    if ( arr[i]==5)
    $x('graduate').style.backgroundColor='red';
    if ( arr[i]==6)
    $x('distance').style.backgroundColor='red';
    if ( arr[i]==7)
    $x('career').style.backgroundColor='red';
    if ( arr[i]==8)
    $x('photo').style.backgroundColor='red';
    </script>
    <table cellpadding='0' cellspacing='0' border='0'>
    <tr><td>
    <input type='button' id='graduate' value='Graduate'>
    </td>
    <td>
    <input type='button' id='distance' value='Distance'>
    </td>
    <td>
    <input type='button' id='career' value='Career/Tech'>
    </td>
    <td>
    <input type='button' id='photo' value='Photos'>
    </td>
    </tr></table>
    2) Defined the application process  GETPROJECTS as DECLARE
    IDS varchar2(1000);
    l_act_code varchar2(100) :=4;
    begin
    IDS:='';
    l_act_code := wwv_flow.g_x01;
    for x in(
    SELECT ACT_CODE,PROJECT_ID
    FROM ASQ_CONTACT
    where ACT_CODE = l_act_code)
    LOOP
    IDS := IDS || X.PROJECT_ID|| ':' ;
    END LOOP;
    HTP.PRN(IDS);
    END;
    3) Changed the 'onchange' event-handler on p1_act_code to be 'onchange=hilitebtn(this.value)'
    4) Added the JS to the HTML Page Footer <script>
    hilitebtn($v('P1_ACT_CODE'));
    </SCRIPT>

  • Passing flexfield from report wrapper to seeded report using shell script

    I am unable to pass flexfield values from report wrapper to seeded report using shell script
    below is the shell script that i am using to transfer GL Account High and GL Account Low to the seeded program Receipt Journal Report (ARXRJR). the flex fields get passed through the parameter v_param_12 and v_param_13. but all i am getting in the seeded report log file is the reporting level,reporting context,set_of_books,period, gl_date_low/high .
    #TEST Program for Passing GL Account High and GL Account Low
    v_user_name=`echo $3`
    v_login_pwd=`echo $FCP_LOGIN`
    v_prog_name=`echo TESTARXRJR`
    echo 'v_prog_name: '$v_prog_name
    # testing for passing the arguments from CM ...
    if [ -z "$1" ]
    then
    echo "Please pass the first argument...."
    exit 1
    fi
    v_request_id=`echo $4`
    echo 'v_request_id: '$v_request_id
    v_param_1=`echo $5`
    echo 'v_param_1: '$v_param_1
    v_param_2=`echo $6`
    echo 'v_param_2: '$v_param_2
    v_param_3=`echo $7`
    echo 'v_param_3: '$v_param_3
    v_param_4=`echo $8`
    echo 'v_param_4: '$v_param_4
    v_param_5="$9"
    echo 'v_param_5: '$v_param_5
    shift
    v_param_6=`echo $9`
    echo 'v_param_6: '$v_param_6
    shift
    v_param_7=`echo $9'`
    echo 'v_param_7: '$v_param_7
    shift
    v_param_8=`echo "$9"`
    echo 'v_param_8: '$v_param_8
    shift
    v_param_9=`echo $9`
    echo 'v_param_9: '$v_param_9
    shift
    v_param_10=`echo $9`
    echo 'v_param_10: '$v_param_10
    shift
    v_param_11=`echo $9`
    echo 'v_param_11: '$v_param_11
    shift
    v_param_12=`echo $9`
    echo 'v_param_12: '$v_param_12
    shift
    v_param_13=`echo $9`
    echo 'v_param_13: '$v_param_13
    shift
    v_param_14=`echo $9`
    echo 'v_param_14: '$v_param_14
    shift
    v_param_15=`echo $9`
    echo 'v_param_15: '$v_param_15
    shift
    v_param_16=`echo $9`
    echo 'v_param_16: '$v_param_16
    shift
    v_param_17=`echo $9`
    echo 'v_param_17: '$v_param_17
    shift
    v_param_18=`echo $9`
    echo 'v_param_18: '$v_param_18
    shift
    v_param_19=`echo $9`
    echo 'v_param_19: '$v_param_19
    shift
    v_param_20=`echo $9`
    echo 'v_param_20: '$v_param_20
    shift
    v_param_21=`echo $9`
    echo 'v_param_21: '$v_param_21
    shift
    v_param_22=`echo $9`
    echo 'v_param_22: '$v_param_22
    shift
    v_param_23=`echo $9`
    echo 'v_param_23: '$v_param_23
    echo "Executiong SQL to obtain org id and responsibility name"
    (sqlplus -s /nolog <<end_of_sql
    conn $v_login_pwd
    set heading off
    set echo off
    set feedback off
    SELECT 'ORGID:'||b.profile_option_value || ':' ||e.responsibility_name
    FROM fnd_profile_options a,
    fnd_profile_option_values b,
    fnd_concurrent_requests c,
    fnd_responsibility d,
    fnd_responsibility_tl e
    WHERE c.request_id = $v_request_id
    AND c.responsibility_id = b.level_value
    AND b.profile_option_id = a.profile_option_id
    AND a.application_id = b.application_id
    AND c.responsibility_application_id = d.application_id
    AND d.application_id = e.application_id
    AND a.profile_option_name = 'ORG_ID'
    AND c.responsibility_id = d.responsibility_id
    AND d.responsibility_id = e.responsibility_id;
    exit
    end_of_sql
    ) > a.log
    v_var=`grep -iv "ORG_ID" a.log|sed 's/Connected.//'`
    echo 'v_var: ' $v_var
    v_org=`echo $v_var| awk 'FS=":" {print $2 }'`
    v_resp_name=`echo $v_var | awk 'FS=":" {print $3}'`
    echo 'v_org :'$v_org
    echo 'v_resp_name :'$v_resp_name
    echo 'Sumitting Receipt Journal Report...'
    user_request=`CONCSUB $v_login_pwd GL "$v_resp_name" $v_user_name WAIT=Y CONCURRENT AR ARXRJR \
              \"$v_param_3\"\
              \"$v_param_4\"\
              \"$v_param_5\"\
              \"$v_param_6\"\
              \"$v_param_7\"\
              \"$v_param_8\"\
              \"$v_param_9\"\
              \"$v_param_10\"\
              \"$v_param_11\"\
              \"$v_param_12\"\
              \"$v_param_13\"\
              \"$v_param_14\"\
              \"$v_param_15\"\
              \"$v_param_16\"\
              \"$v_param_17\"\
              \"$v_param_18\"\
              \"$v_param_19\"\
              \"$v_param_20\"\
              \"$v_param_21\"\
              \"$v_param_22\"\
              \"$v_param_23\"`
    user_request=`echo $user_request|awk '{print $3}'`
    echo Request is $user_request
    trx_rep_file="$user_request"
    echo 'trx_rep_file: '$trx_rep_file
    sleep 10
    for i in 1 2 3 4 5
    do
    if test -f $APPLCSF/$APPLLOG/l$user_request.req
    then
    if test [`grep -i '"Concurrent process completed successfully"' $APPLCSF/$APPLLOG/l$user_request.req`]
    then
    if test -f $APPLCSF/$APPLOUT/o$trx_rep_file.out
    then
    echo +++++++++++++++++++++++++++++++++
                   echo 'output file found'
                   echo ++++++++++++++++++++++++++++++++++++++
    else
    echo +++++++++++++++++++++++++++++++++++++++++
              echo failure in Report listing production
              echo +++++++++++++++++++++++++++++++++++++++
    fi
    break
    else
    echo +++++++++++++++++++++++++++++++++++++++
    echo Job not Over Yet
         echo +++++++++++++++++++++++++++++++++++++++++++++
    fi
    echo +++++++++++++++++++++++++++++++++++++++
    echo File not found yet
    echo ++++++++++++++++++++++++++++++++++++++
    fi
    sleep 10
    done
    echo ----------------------------------------------------------
    echo Transaction Listing process over
    echo ---------------------------------------------------------
    echo ----------------------------------------------------------
    echo Executing SQL to derive Search Pattern
    echo ----------------------------------------------------------
    v_pattern=`sqlplus -s /nolog <<EOF1
    conn $v_login_pwd
         set heading off
         set echo off
         set feedback off
         SELECT 'SEARCH^'||meaning||'^'||attribute1||'^'||attribute2||'^'||attribute3
         FROM fnd_lookup_values
         WHERE lookup_type = '$v_param_2'
         AND lookup_code = '$v_prog_name';
    exit
         EOF1`
    echo 'v_pattern: '$v_pattern
    v_pattern_n1=`echo $v_pattern|sed 's/Connected.//'|awk 'FS="^" {print $2}'`
    echo 'v_pattern_n1: '$v_pattern_n1
    v_pattern_n2=`echo $v_pattern|sed 's/Connected.//'|awk 'FS="^" {print $3}'`
    echo 'v_pattern_n2: '$v_pattern_n2
    v_pattern_n3=`echo $v_pattern|sed 's/Connected.//'|awk 'FS="^" {print $4}'`
    echo 'v_pattern_n3: '$v_pattern_n3
    v_pattern_n4=`echo $v_pattern|sed 's/Connected.//'|awk 'FS="^" {print $4}'|sed 's/ //'`
    echo 'v_pattern_n4: '$v_pattern_n4
    echo 'v_param_12: '$v_param_12
    echo 'v_param_13: '$v_param_13
    echo -----------------------------------
    echo Deriving final output
    echo ----------------------------------
    v_var=`cat $APPLCSF/$APPLOUT/o$trx_rep_file.out | grep -i "$v_pattern_n1"|\
                   sed "s/(/-/g"|sed "s/)/ /g"|\
                   sed "s/$v_pattern_n1/$v_pattern_n2/g"|\
              sed 's/ /~/g'|\
    sed 's/~~*/~/g'|\
                   sed 's/ *//g'|\
                   sed 's/,//g'`
    echo 'v_var: '$v_var
    v_var_2=`cat $APPLCSF/$APPLOUT/o$trx_rep_file.out|grep -i "$v_pattern_n3"|\
                   uniq`
    v_out_1=`echo "$v_var"|grep -i "$v_pattern_n2"|awk 'FS="~" {print $3}'`
    echo 'v_out_1: '$v_out_1
    echo 'v_var_2: '$v_var_2
    echo ------------------------------------------------------------
    v_out_2=`echo "$v_var_2"|grep -i "$v_pattern_n3"|awk 'FS=":" {print $2}'`
    echo 'v_out_2: '$v_out_2
    echo ----------------------------------------------
    echo Process comleted
    echo ----------------------------------------------------
    echo ================================================================================
    #---------------------------------------------------------------------------------------------------

    The name of this OTN group is "Database - General"
    Your question relates to an unnamed application that might be E-Business Suite, or PeopleSoft, or Siebel, who can say.
    Please re-ask your question in the appropriate applications forum and be sure to clearly name the full product name and version. We are not mind readers and we can not look over your shoulder.

  • Pass a list of number values to a pl/sql function

    I would like to pass a list of number values to a pl/sql function where the list will be used in an IN clause. Ideally I would like to do the following:
    CREATE OR REPLACE FUNCTION ( dept_list in varchar2) is
    begin
    select ... where dept in (dept_list) ;
    usage: process_list ( '7730,7735,7740,7745') ;
    I can not find an example of doing this in pl/sql function but it seems feasible.
    Is there a way to do this?

    user12088323 wrote:
    I would like to pass a list of number values to a pl/sql function where the list will be used in an IN clause.
    usage: process_list ( '7730,7735,7740,7745') ;The first thing is you need an appropriate data type to store a list of numbers. A single character value that looks to you like a list of numbers, is not in fact a list of numbers but a single character value.
    This example uses the built in data type odcinumberlist in a procedure, you can do the same in function
    Re: Passing an array to an Oracle stored procedure
    If you have an old version of the database you may need to create your own type with the same definition of odcinumberlist.

  • Using return value of a pl/sql function in the "where" coarse in a

    Hi,
    I have a question,
    if I have a pl/sql function that returns a boolean value, how can I use
    it directly in a select statement?
    I can easily do this if the function returns a number value , e.g.
    select * from my_table where my_package.function('abc') = 1;
    But I can't figure out how to do this if the function return a boolean.
    Any idea other than creating another function?
    Please reply to me directly as I'm not in the email list. Thanks.

    BOOLEAN is not a SQL datatype - you can only reference Boolean values in PL/SQL.

  • How to use a select list value in a PL/SQL function body returning SQLquery

    Hi Friends,
    I have a select list P6_TEST with values 'nav' anf 'jyo'. I am trying to create a report using "SQL Query (PL/SQL
    function body returning SQL query)". In my report query can i check if P6_TEST='nav' and do something like the
    code shown below.How can i do that.
    DECLARE
    v_sql VARCHAR2(3000);
    BEGIN
    IF :P6_TEST = 'nav' THEN
    v_sql :=
    'SELECT
    * from department';
    ........................Thanks,
    Nav

    Nav:
    What you have should work. Give it a go. Post back if you run into issues.
    Varad

  • Some "formula" interpreter or returning value from unnamed PL/Sql blocks

    Hello,
    My company is developing Payroll and HR software and we use Oracle 10G Database. For a new module we are looking for a system were the end user (power user) can put in some kind of "formula's" to define what info/figures he wants for certain calculations done by de module (the budget module calculations will be done in PL/SQL stored proc written by us).
    Example: item "MonthlySalaryCost" = (BaseYearSal + TotalBonus)/12
    Where BaseYearSal and TotalBonus are functions that exist our will exist in or database. The idea is that a PL/SQL proc (which will be the same for all our customers), at runtime will execute that "formula" and use the result in its further calculations. The "formulas" will be stored in a table. (I foresee of course a "formula" validation to prevent dangerous sql-injection).
    My idea was to use Execute Immediate in the proc to execute the formula's and work with the results. In this approach we have to write (and foresee) all possible functions to access the data the user wants to use.
    Another (more powerful) solution I think about, is seeing these "formula's" as unnamed PL/SQL blocks (stored in a table), were the end user (or consultant) can use the full power of PL/SQL (if then else, select into ..., etc..) to obtain the result he wants to return into the item.
    My problem here is : how to return a value from a unnamed PL/SQL block that is executed via Execute Immediate in a stored proc ?
    And a general question: what do you think of this approach ? are there others possibilities to do this ?
    Thanks in advance,
    Philippe.

    Hi,
    Welcome to the forum!
    This is a simple example:
    Some functions to test:
    CREATE OR REPLACE FUNCTION f_test1 RETURN NUMBER IS
       RESULT NUMBER;
    BEGIN
       RESULT := 12;
       RETURN(RESULT);
    END f_test1;
    CREATE OR REPLACE FUNCTION f_test2 RETURN NUMBER IS
       RESULT NUMBER;
    BEGIN
       RESULT := 10;
       RETURN(RESULT);
    END f_test2;
    CREATE OR REPLACE PACKAGE pack_test_functions IS
       PROCEDURE proc_test;
    END pack_test_functions;
    CREATE OR REPLACE PACKAGE BODY pack_test_functions IS
       PROCEDURE proc_test IS
          v_sql    VARCHAR2(4000);
          v_result NUMBER;
       BEGIN
          v_sql := 'SELECT F_TEST1() + F_TEST2() FROM DUAL';
          EXECUTE IMMEDIATE v_sql
             INTO v_result;
          dbms_output.put_line(v_result);
       END proc_test;
    END pack_test_functions;
    /into v_result you have the result of the operation.
    Regards,

  • How to pass multiple values from workbook to planning function ?

    Hi,
    I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
    When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
        A.) input one value -> V1
        B.) input three values -> V1;V2;V3
    This function execute completely in web.
    However, I want to use the planning function in workbook(Excel).
    The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
    thank you.

    Hi,
    Please see the attached how to document (page no 16).
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
    Hope this was helpful
    thanks

  • Setting Oracle Permissions for file access from a pl/sql function

    I have a pl/sql function that calls a java method which moves a
    file from a directory to another.
    Since we are using Linux, Oracle wants some permissions.
    Those permissions are set using:
    call dbms_java.grant_permission(USER, 'java.io.FilePermission',
    FILE, permission)
    OK, i want to use this in my pl/sql function, but it doesn't
    work.
    My function looks like something like this:
    -- some pl/sql code
    dbms_java.grant_permission(someUSER, 'java.io.FilePermission',
    sourceFILE, 'write');
    dbms_java.grant_permission(someUSER, 'java.io.FilePermission',
    destFILE, 'write');
    flag := move(sourceFILE, destFILE);
    -- flag is for 1 -> done and 0 -> error
    -- some more code ...
    The problem is the lines of
    dbms_java.grant_permission(someUSER, 'java.io.FilePermission',
    sourceFILE, 'write');
    do not work!
    When i grant permissions manually in sql plus it works great,
    but when i do it from the function it does not work!
    Any ideas anyone?
    Any help would be appreciated.

    The command :
    dbms_java.grant_permission
    (someUSER, 'java.io.FilePermission',sourceFILE, 'write');
    is right.
    Open sqlplus
    Connect as sys or system
    type :
    execute dbms_java.grant_permission
    (someUSER, 'java.io.FilePermission',sourceFILE, 'write');
    commit;
    try to compile again your procedure...does it work now ?
    bye
    Giovanni Regola

  • APEX_MAIL.SEND from a pl/sql function

    I have created a pl/sql function, in the database, in which I would like to use APEX_MAIL.SEND to send out emails.
    When I try to compile I get the following errors:
    Compilation failed,line 10 (08:44:32)
    PLS-00307: too many declarations of 'SEND' match this callCompilation failed,line 10 (08:44:32)
    PL/SQL: Statement ignored
    Here is the relavent code. Line 10 is the line where I have APEX_MAIL.SEND
    LOOP
    APEX_MAIL.SEND (
    P_TO => email_rec.TO_EMAIL,
    P_FROM => email_rec.FROM_EMAIL,
    P_BODY => email_rec.BODY,
    P_BODY_HTML => email_rec.BODY,
    P_SUBJ => email_rec.SUBJECT );
    I am in APEX version 3.0.0.00.20
    I can send mail from a APEX application procedure. The function I am having trouble with is one that can be accessed under the SQL Workshop --> Object Browser --> Functions.
    Other functions work fine.
    Thanks.

    Have a look at the following thread Re: HTMLDB_MAIL.SEND Cursor for loop
    It might be a problem of your data types you have defined in email_rec. Eg. do you have a CLOB for SUBJECT?
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • Unable to capture the parameter values from a PL/SQL procedure

    hi.
    i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
    Please help me regarding.
    i'm using following block for calling the procedure.
    declare
    err_cd varchar2(1000);
    err_txt VARCHAR2(5000);
    no_of_recs number;
    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
    cntr_var number:=0;
    begin
         rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
         dbms_output.put_line('The error is ' ||err_cd);
         dbms_output.put_line('The error is ' ||err_txt);
         dbms_output.put_line('The cntr is ' ||cntr_var);
         for incr in 1 .. OUT_SIGN_TAB.count
         loop
         cntr_var := cntr_var + 1 ;
    Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
    end loop;
    end;
    Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
    Following is some related information.
    the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
    TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
    TYPE "SEARCH_SIGN_TYPE" AS OBJECT
    (ref_no VARCHAR2(22),
    ciref_no VARCHAR2(352),
    ac_no VARCHAR2(22),
    txn_type VARCHAR2(301),
    objid VARCHAR2(1024))............

    We don't have your rt843pq procedure, but when commenting that line out, everything works:
    SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
      2  (ref_no VARCHAR2(22),
      3  ciref_no VARCHAR2(352),
      4  ac_no VARCHAR2(22),
      5  txn_type VARCHAR2(301),
      6  objid VARCHAR2(1024))
      7  /
    Type is aangemaakt.
    SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
      2  /
    Type is aangemaakt.
    SQL> declare
      2    err_cd varchar2(1000);
      3    err_txt VARCHAR2(5000);
      4    no_of_recs number;
      5    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
      6    cntr_var number:=0;
      7  begin
      8    -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
      9    dbms_output.put_line('The error is ' ||err_cd);
    10    dbms_output.put_line('The error is ' ||err_txt);
    11    dbms_output.put_line('The cntr is ' ||cntr_var);
    12    for incr in 1 .. OUT_SIGN_TAB.count
    13    loop
    14      cntr_var := cntr_var + 1 ;
    15      Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
    TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
    16    end loop;
    17  end;
    18  /
    The error is
    The error is
    The cntr is 0
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • Passing Value from Crystal Report (special function) to Business View parameter

    Friends,
                 Í have a scenario where i need to pass value from Crystal Report to a Business view's parameter.
    Eg : CurrentCEUsername (func in crystal report)-- gives login user  which i should pass to parameter in a Business view (used in the same report).
    Will be able to explain more if required.
    Thanks in Advance,
    Bharath

    I guess you got the picture wrong.  User_id is not a report_level parameter .
    In Data Foundation, below query is used..
    select Acc_Number, Account_Group,User_id  from Accounts where user_id={?User_id}
    where in {?User_id}  is the BV parameter...
    The Filter was a solution. But it takes long time to Query all the data from DB and then filter at BV level.
    How do i pass the CurrentCEUsername to {?User_id}
    Value should ve CurrentCEusername always. so that query will be
    select Acc_Number, Account_Group,User_id  from Accounts where user_id=CurrentCEusername
    It will restrict the data pulled from DB to BV .. right?

  • Procedure call from SQL*Plus in Korn Shell Script

    I am trying to excute a procedure from sqlplus, truncate_audit_table. I doesn't execute. If I do it manually
    it executes. I have tried multiple ways, as below. This is inside a Korn Shell scripts that creates the procedure
    and counts the aud$ table. All that works, but does not truncate the aud$ table. It does not do it, no error, just
    passes it by. Does anybody know why?
    ${ORACLE_HOME}/bin/sqlplus -s / << EOF | tee -a ${LOG}
    set feedback on
    @/backup/oracle/orcl/audit/truncate_audit_table.sql
    select count(*) from sys.aud$;
    exec truncate_audit_table;
    exit
    EOF
    ${ORACLE_HOME}/bin/sqlplus -s / << EOF | tee -a ${LOG}
    set feedback on
    @/backup/oracle/orcl/audit/truncate_audit_table.sql
    select count(*) from sys.aud$;
    begin
         truncate_audit_table;
    end;     
    exit
    EOF
    This is the procedure that is being called:
    create or replace procedure truncate_audit_table
    as
    begin
    execute immediate 'truncate table sys.aud$';
    end;
    /

    aud$ is owned by sys. You can see it does the count with or without the "\".
    It creates the procedure under SYS , but does not execute it.
    Truncate aud$ table...
    Procedure created.
    COUNT(*)
    422
    1 row selected.
    ===============================================================
    audit_maintenance.ksh Completed: Thu Oct 26 14:03:17 GMT 2006
    ===============================================================

  • Sql Loader by using shell script, not able to insert data

    Hi,
    I am trying to dump the data by using shell script.(in shell script i am having sqlldr command)(its a host excutable method cocurrent program)
    When i am loading the data, by placing my files(.ctl,.prog,.csv,symbolink file for .prog) in $Custom_top/bin, it is loading exactly. 17000 records inserted.
    But if i am loading the data by placing my files in $custom_top/custom_folders. unable to insert total data. only 43 records inserting.
    Please any one can help me.
    Thanks in advance.
    Rama.

    Srini, Thanks a lot for ur reply,
    Oracle Apps version R12,
    Microsoft windows XP profissional
    Version 2002 service Pack 3
    My Control file Script is:
    load data
    infile '$XADP_TOP/data/CPIU/in/XXOKS_Price_Increase.csv'
    append
    into table XXOKS_CONTRACT_PRICE_INCR_DTLS
    fields terminated BY ',' optionally enclosed by '"'
    TRAILING NULLCOLS
    (EXCLUSION_FLAG,
    LEGACY_NUMBER,
    CUSTOMER_NUMBER,
    CUSTOMER_NAME,
    REQUEST_ID,
    CONTRACT_NUMBER,
    CONTRACT_START_DATE,
    CONTRACT_END,
    REQUEST_LINE_ID,
    LINE_START_DATE,
    LINE_END_DATE,
    ITEM_NUMBER,
    ITEM_DESCRIPTION,
    UNIT_PRICE,
    QTY,
    NEW_UNIT_PRICE,
    LINE_AMOUNT,
    NEW_LINE_AMOUNT,
    PRICE_INCREASED_DATE,
    PERCENTAGE_INCREASED,
    ORIGINAL_CONTRACT_AMOUNT,
    NEW_CONTRACT_AMOUNT,
    PRICE_INCREASE_AMOUNT)
    My .prog File is: Please fidn that i created symbolink file also for my .prog.
    if [ -z $XADP_TOP ];then
    echo "XADP_TOP environment variable is not set!"
    exit 1
    fi
    cd $XADP_TOP/data/CPIU/in
    DATE=`date +%y%m%d:%H%M`
    i_program_name="$0"
    i_ora_pwd="$1"
    i_user_id="$2"
    i_user_name="$3"
    i_request_id="$4"
    i_ftp_host_name="$5"
    i_ftp_user_name="$6"
    i_ftp_user_password="$7"
    ftp_prog() {
    # FTP Function to reuse the FTP Commands
    if [ $# -ne 6 ];then
    echo "Usage : ftp_prog <Hostname> <User name> <Password> <Remote Directory> <command> <filename>"
    exit 2
    fi
    l_ftp_host_name="$1"
    l_ftp_user_name="$2"
    l_ftp_user_password="$3"
    l_ftpdir="$4"
    l_ftp_command="$5"
    l_ftp_filename="$6"
    ftp -v -n ${l_ftp_host_name} <<EOF
    user ${l_ftp_user_name} ${l_ftp_user_password}
    ascii
    cd ${l_ftpdir}
    ${l_ftp_command} ${l_ftp_filename}
    quit
    EOF
    #exit $?
    # setting the ftp directory
    #ftpdir="/`echo ${TWO_TASK:-$ORACLE_SID}|tr "[A-Z]" "[a-z]"`/CPIU"
    ##ftpdir="/FinTEST/quoting/PS/ar"
    ftpdir="$XADP_TOP/data/CPIU/in"
    # setting the in directory and out directory
    indir="$XADP_TOP/data/CPIU/in"
    outdir="$XADP_TOP/data/CPIU/out"
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} get XXOKS_Price_Increase.csv
    echo $ftpdir
    echo "Converting the data file into unix mode"
    dos2unix XXOKS_Price_Increase.csv XXOKS_Price_Increase.csv
    chmod 777 XXOKS_Price_Increase.csv
    cd $XADP_TOP/bin
    echo "Trying to excute sqlldr and entering into the into control file"
    $ORACLE_HOME/bin/sqlldr userid=$i_ora_pwd control=XXOKS_PRICE_INCR_LOAD log=$XADP_TOP/log/XXOKS_PRICE_INCR_LOAD_${DATE}.log;
    exit_status=$?
    echo "Checking the status and giving permissions to the data file which in in dir"
    if [ $exit_status -eq 0 ]; then
    cd $XADP_TOP/data/CPIU/in
         chmod 777 XXOKS_Price_Increase.csv
    echo "try to move data file into out dir"
    # Moving the file to out directory
    mv XXOKS_Price_Increase.csv ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    #echo "ready to zip file in out dir step6"
    # Zipping the file
    #gzip -f ${outdir}/XXOKS_Price_Increase.csv_${DATE}
    echo "deleting the file which is in dir"
    # Deleting the file from in directory
    /bin/rm -f ${indir}/XXOKS_Price_Increase.csv
    # Deleting from the remote directory
    ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} delete XXOKS_Price_Increase.csv
    echo "sqlloader finished successfully."
    else
    echo "Error in loader"
    ##echo "Loader error in Price Increase Detials File ${i_file}"
    fi
    exit $exit_status
    And My Log file Comments are
    SQL*Loader: Release 10.1.0.5.0 - Production on Thu Dec 3 01:32:08 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: XXOKS_PRICE_INCR_LOAD.ctl
    Data File: /oesapp/applmgr/GIS11/apps/apps_st/appl/xadp/12.0.0/data/CPIU/in/XXOKS_Price_Increase.csv
    Bad File: XXOKS_Price_Increase.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    EXCLUSION_FLAG FIRST * , O(") CHARACTER
    LEGACY_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NUMBER NEXT * , O(") CHARACTER
    CUSTOMER_NAME NEXT * , O(") CHARACTER
    REQUEST_ID NEXT * , O(") CHARACTER
    CONTRACT_NUMBER NEXT * , O(") CHARACTER
    CONTRACT_START_DATE NEXT * , O(") CHARACTER
    CONTRACT_END NEXT * , O(") CHARACTER
    REQUEST_LINE_ID NEXT * , O(") CHARACTER
    LINE_START_DATE NEXT * , O(") CHARACTER
    LINE_END_DATE NEXT * , O(") CHARACTER
    ITEM_NUMBER NEXT * , O(") CHARACTER
    ITEM_DESCRIPTION NEXT * , O(") CHARACTER
    UNIT_PRICE NEXT * , O(") CHARACTER
    QTY NEXT * , O(") CHARACTER
    NEW_UNIT_PRICE NEXT * , O(") CHARACTER
    LINE_AMOUNT NEXT * , O(") CHARACTER
    NEW_LINE_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASED_DATE NEXT * , O(") CHARACTER
    PERCENTAGE_INCREASED NEXT * , O(") CHARACTER
    ORIGINAL_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    NEW_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
    PRICE_INCREASE_AMOUNT NEXT * , O(") CHARACTER
    value used for ROWS parameter changed from 64 to 43
    Table XXOKS_CONTRACT_PRICE_INCR_DTLS:
    43 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 255162 bytes(43 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 43
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Dec 03 01:32:08 2009
    Run ended on Thu Dec 03 01:32:08 2009
    Elapsed time was: 00:00:00.19
    CPU time was: 00:00:00.04
    Plz srini help me.
    Thanks in advance
    Rama..

  • SQL Alias's in Shell Script

    Hello all,
    We are running Oracle 10G on Unix and I am fairly new to Unix. I know how to assign a SQL select statements values to an alias in a SQL environment such as TOAD, such as for example;
    Select LogID ID, LogType Type, LogDate Date from audit_logs
    where LogDate = sysdate;
    That will give the determined values the labels of ID, Type, and Date respectively. But how do I assign the multiple SQL select values to shell script variables in UNIX? I have found how to do it for a single value but not a multiple value.
    Thanks in advance
    Regards
    Alano

    Thanks for reply.
    What we want to do is ensure a relevant file was deleted by a database package\procedure that is part of a third party application. My aim will be to interrogate the relevant table, extract the three relevant fields and join them together into one line\string that will be appended to a lof file
    Thanks again in advance
    Regards
    Alano

Maybe you are looking for

  • Default text is populated in header text while creating PO.

    Hi All,          Can someone help me with some inputs on this issue. 1) <b> A particular PO header text is appearing by default when we click on Long Text tab and coming back in the TCode ME21.</b> 2)  Irrespective of the organization details, Vendor

  • Help with buttons on a JSP Page

    Hi All, I have a HTML page , that has certain text fields.... on entering values into the text fields, it is directed to a servlet. The servlet(puts the values into the database) then directs to a jsp with the values entered in the form. I would like

  • Backing up....syncing?

    I need some help, please. I'm returning a defective ipad and I will have to restore from a back up and I think I would prefer to back up from itunes because the last time I backed up from icloud it took more than 24 hours. I just synced to itunes at

  • How can I get a netgear wgps606 to work?

    How can I get a netgear wgps606 to work.  Just bought a new mac mini running Lion

  • MacBook Pro bluetooth cannot see Officejet 100

    According to HP instructions, when I attempt to add a printer (via System Preferences), I should select the HP Officejet 100 "with Bluetooth beside its name."  It does not show up.  If I ask bluetooth to find a device, the printer doesn't show up.  I