PL/SQL function debugging in NetBeans

Hello.
I have a PL/SQL function which I call from my JDBC code (the Java application is being developed using NetBeans). My function takes many arguments of different types. When I test it using SQL*Plus it works fine. When I call the function from the java code -- it does not work.
What is the right way to debug my PL/SQL function once it is called from the Java application?
Thank you!
Mark.

Make sure your parameters for the callable statement are registered correctly. Here is an example of a call made to an oracle function called "my_function" that returns a cursor:
CallableStatement callst = conn.prepareCall("{call ? := my_function(?)}");
callst.registerOutParameter(1, OracleTypes.CURSOR);
callst.setInt(2,999);  //999 is the value being passed in
callst.executeUpdate(); Post the error message you are getting in java, if it works fine from the SQL prompt then it must be java.

Similar Messages

  • How to debug PL/SQL function in Apex

    Hi,
    I have a process in Apex that uses a PL/SQL function. When I compiled it in SQLPlus, it had no errors, yet when running it in Apex, I get an error.
    'Encountered unhandled exception in process type PLSQL' in the debug message. What's the best way to handle this? Thanks.

    Hi -
    Its hard to say without seeing the code of your process, but are you sure you are submitting any required paramaters to your process from the calling apge in Apex?
    Have you checked the Session to see what values it holds, and have you turned on Debug in Apex to see the code executing (or at least the call to your process)?
    Good luck.

  • Help w/MaxDB Function; also: how does the "Debug SQL" function work?

    Hi there forum folks,
    In my former life, I was a Basis guy, but I haven't had the pleasure of working directly with SAP applications in a few months.  My current project is to attempt to use MaxDB in a real estate environment.  We're tracking home listings so that we can build statistical reports... such as "what agents are in the Top 100 in postal code X?"
    Anyway, as part of this project, I have attempted to construct my very first MaxDB database function.  Unfortunately, it doesn't give me the answers I'm hoping to see.  Here's the function:
    CREATE FUNCTION COUNT_LISTINGS (AGENTID CHAR(10)) RETURNS FIXED(6,1) AS
      VAR COLISTINGAGENTID CHAR(10);
          LISTINGAGENTID   CHAR(10);
          MLSNUMBER        CHAR(7);
          UNITS            FIXED(6,1);
      SET UNITS = 0;
      DECLARE FUNCTIONRESULT CURSOR FOR
        SELECT MLSNUMBER,
               LISTINGAGENTID,
               COLISTINGAGENTID FROM FREDDIE.GLAR_SOLDS
         WHERE LISTINGAGENTID = :agentid OR COLISTINGAGENTID = :agentid;
      IF $COUNT IS NULL THEN
        BEGIN
          CLOSE FUNCTIONRESULT;
          RETURN UNITS;
        END
      ELSE
        SET $RC = 0;
      WHILE $RC = 0 DO BEGIN
        FETCH FUNCTIONRESULT INTO :mlsnumber, :listingagentid, :colistingagentid;
        IF ( LISTINGAGENTID   = AGENTID AND COLISTINGAGENTID IS NULL ) OR
           ( COLISTINGAGENTID = AGENTID AND LISTINGAGENTID   IS NULL ) THEN
          SET UNITS = UNITS + 1
        ELSE
          SET UNITS = UNITS + 0.5;
      END;
    CLOSE FUNCTIONRESULT;
    RETURN UNITS;
    I've tried to follow the official MaxDB documentation.  My first deviation from that standard was the use of the "$COUNT" variable (instead of the "$RC" variable) immediately after the DECLARE/SELECT statement above.  When I tried to use $RC, for either a successful or unsuccessful query, $RC was always set to a non-zero value.
    I believe I'm past that, but now my issue is down around that FETCH statement.  The UNITS variable doesn't end up with the value I expect.  I know that it can be terribly confusing to try to analyze someone else's logic, but here's a brief narrative that describes what I'm trying to do...
    The GLAR_SOLDS table holds one line for each home sold.  It's keyed by the MLSnumber.  Each record also stores up to four agents who've been involved in the transaction: the listing agent, the co-listing agent, the selling agent, and the co-selling agent.  The database function I've written above pertains to the listing side only.  If I can get this to work, a separate function will process the selling side.  If no co-listing agent is involved in a given sell, that agent should get credit for 1 unit sold.  If he/she has help from a co-listing agent, the agent should only get credit for 1/2 unit sold.
    Also, does anyone know how the "Debug SQL" functionality is supposed to work within Database Studio?  When I right-mouse click on my function, and follow the path thru "Debug As...", after entering the connection & function arguments, I'm presented with an empty screen.  If you could point me to some documentation somewhere, I'd gratefully read it.
    I'm using MaxDB 7.7.06.09 on Windows XP (WIN32) with MaxDB Database Studio 7.7.06.09 (build 009-123-202-944).
    Thanks everyone for your help & advice.
    ~Fred

    Fred,
    please either provide the full SQL statements for your example or stick with mine.
    I'm not going to build it up myself a second time to suit yours now.
    >  But now, my issue is how do I store the resultant data in its own table?
    So where is the problem?
    INSERT INTO <target table> (field 1, field 2, ...)  (<your query>)  UDPATE DUPLICATES-
    With my tables this looks like this:
    create table sell_result (list_agent varchar(20) primary key, SUM_CREDIT fixed (10,2))
    insert
    into sell_result (list_agent,sum_credit)
        ( select list_agent, sum (credit) as SUM_CREDIT
          from ( select sh.object_id,lag.name as list_agent, 1 as credit
                 from soldhomes sh join agents lag on lag.id = sh.list_agent_id
                union all
                 select sh.object_id, lag.name as list_coagent, 0.5 as credit
                 from soldhomes sh join agents lag on lag.id = sh.list_coagent_id
          group by list_agent
    update duplicates
    Check what we have now
    sqlcli db770=> select * from sell_result
    | LIST_AGENT           | SUM_CREDIT        |
    | -------------------- | ----------------- |
    | Lars                 |              4.50 |
    | Lisa                 |              3.00 |
    | Mona                 |              2.50 |
    | Paul                 |              2.50 |
    4 rows selected (600 usec)
    Now add some sales data...
    Insert into soldhomes values (11, 1, 2, NULL, NULL)
    Insert into soldhomes values (12, 2, NULL, NULL, NULL)
    Insert into soldhomes values (13, 2, NULL, NULL, NULL)
    Re-run the INSERT command and you're done:
    sqlcli db770=> select * from sell_result
    | LIST_AGENT           | SUM_CREDIT        |
    | -------------------- | ----------------- |
    | Lars                 |              5.50 |
    | Lisa                 |              3.00 |
    | Mona                 |              5.00 |
    | Paul                 |              2.50 |
    4 rows selected (390 usec)
    Neat, isn't it?

  • Debugging PL/SQL Functions - Aaghh help!

    Hi. this is driving me nutz.
    here is my function:
    CREATE OR REPLACE FUNCTION MYPROC_GETCOMPID
    COMPNAME IN VARCHAR2,
    SITEID IN INTEGER
    RETURN NUMBER IS
    RVAL INTEGER;
    LOCALVAR INTEGER;
    BEGIN
    SELECT COMPUTERID INTO LOCALVAR
    FROM DATAUPLOAD.COMPUTER_LIST WHERE
    COMPUTERNAME = COMPNAME AND
    SITE = SITEID;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    LOCALVAR := 0;
    RVAL:=LOCALVAR;
    RETURN RVAL;
    dbms_output.put_line('Local var');
    dbms_output.put_line(LOCALVAR);
    END MYPROC_GETCOMPID;
    It gets created fine. My question is, how the F can I create a bit pl/SQL to debug this?
    I tried:
    begin
    declare localin integer;
    localin := MYPROC_GETCOMPID('MYPC1',1);
    dbms_output.put_line('LOCALINT');
    dbms_output.put_line(LOCALINT);
    END;
    ... and I tried
    begin
    declare localin integer;
    localin = MYPROC_GETCOMPID('MYPC1',1);
    dbms_output.put_line('LOCALINT');
    dbms_output.put_line(LOCALINT);
    END;
    but boy does neither of these work.
    Could someone please tell me whats going wrong??
    AND can you see that exception in the function? thats there because for some reason a simple is null statement fails. any guesses as to why that is happening?
    many thanks for your time
    I

    Hi John,
    Sorry, I didn't include the error output because I thought that it would be obvious to people what was wrong with how I was attempting to call the function. I'm a bit of an oracle newbie (I'm sure thats more than obvious)
    Thanks for your help on the exception. I was just looking for reassurance that I was needing to handle the error like that. The data structure means that I shouldn't get too many rows (1:1 relationship between computername and computerID, thankfully!)
    Heres the responses from SQL*Plus (this is Oracle8i by the way). The responses are the same whether 'MYPC1' exists in the computer_list or not, so I am guessing that there is just something I am doing not quite right in the syntax for calling this function. (infact, see below for a hello world example that also fails).
    --here we see I have set up for screen output okay:-
    SQL> BEGIN
    2 dbms_output.put_line('Hello World!');
    3 END;
    4 /
    Hello World!
    PL/SQL procedure successfully completed.
    SQL>
    -- first failure:
    SQL> begin
    2 declare localin integer;
    3 localin = MYPROC_GETCOMPID('MYPC1',1);
    4 dbms_output.put_line('localin' );
    5 dbms_output.put_line(localin );
    6 END;
    7 /
    localin = MYPROC_GETCOMPID('MYPC1',1);
    ERROR at line 3:
    ORA-06550: line 3, column 9:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    --- so I figure, this is a declarative syntax issue ( = as opposed to := ), so I try the following:
    SQL> begin
    2 declare localin integer;
    3 localin := MYPROC_GETCOMPID('MYPC1',1);
    4 dbms_output.put_line('localin' );
    5 dbms_output.put_line(localin );
    6 END;
    7 /
    localin := MYPROC_GETCOMPID('MYPC1',1);
    ERROR at line 3:
    ORA-06550: line 3, column 9:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    The symbol "<an identifier>" was substituted for "=" to continue.
    ORA-06550: line 4, column 12:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national charac
    ORA-06550: line 5, column 12:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national charac
    ORA-06550: line 6, column 1:
    PLS-00103: Encountered the symbol "END" when expecting one of the following:
    begin function package pragma
    --- finally , 'hello world' failure :
    SQL> begin
    2 declare localst varchar(11);
    3 localst = 'hello world';
    4 dbms_output.put_line('localst');
    5 dbms_output.put_line(localst);
    6 END;
    7 /
    localst = 'hello world';
    ERROR at line 3:
    ORA-06550: line 3, column 9:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar

  • How to debug PL/SQL functions? Passing parameter and debugger error

    Hi,
    How to debug a PL/SQL function in JDeveloper? There are two problems with it:
    1) Don't see how it's possible to pass parameters required by function call (in the dialog opening after Debug -> Debug FUNCTION_NAME)
    2) In a function returning table_name%ROWTYPE (and having a record declaration for table_name%ROWTYPE), debug gives error:
    PLS-00103: Encountered symbol "/" when expecting one of ... in line
    v_Return PL/SQL RECORD;
    Debugging procedures works as expected.
    Found a similar question without answer here:
    Debugging PL/SQL with parameters

    Check
    http://www.oracle.com/technology/obe/obe9051jdev/plsqlobe/obeplsql.htm#t2
    Frank

  • Report- Pl/sql function returning sql query parsing page items as text?

    Hi Team,
    I am facing a strange issue .
    I have four page items namely
    1)JOB_CODE
    2)MIN_EXP
    3) MAX_EXP
    4) SOURCES1
    I have a report of the type "Pl/sql function returning sql query"
    declare
    v_sql varchar2(4000);
    begin
    if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    end if;
    insert into query_list values (v_sql);
    insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
    return v_sql;
    end;
    Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
    Now I select the data from the debug tables.
    select unique(query) from query_list;
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
    select * from debug;
    JOBCODE     MINEX     MAXEX     SOURCE
    21     1     10     donkeyHire
    And if I run the query in sql I get some records returned
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
    V_CANDIDATE_ID     V_FNAME     V_CURRENT_EMPLOYER     V_EXPERIENCE_YEARS
    2     Vengu     Andale Tech     4
    But the record does not show up in the report!
    does this type of report parse page items as text?
    Why is it so?
    Waiting for an early reply.
    Thanks,
    venkat

    Venkat - You don't want to put ':SOURCES1' in quotes like that.
    Scott

  • PL/SQL function. ORA-00933: SQL command not properly ended

    This is my first attempt at pl/sql functions with dynamic sql. It will compile, but when I try to test it I get the ORA-00933 error at line 147. line 147 is OPEN retval FOR report_query;
    Please take a look and let me know what it wrong! thanks
    {CREATE OR REPLACE FUNCTION TSARPTS.Stats (v_Hub       IN VARCHAR2,
                                              v_type      IN VARCHAR2,
                                              v_subtype   IN VARCHAR2)
       RETURN SYS_REFCURSOR
    IS
       retval           SYS_REFCURSOR;
       report_query_a   VARCHAR2 (10000)
                           := '
      SELECT hub,
             CASE
                WHEN Total = 0 OR Pass_1st = 0 THEN 0
                ELSE ROUND (Pass_1st / (Total) * 100, 2)
             END
                AS Pass_1st_percent,
             CASE
                WHEN Total = 0 OR Pass_2nd = 0 THEN 0
                ELSE ROUND (Pass_2nd / (Total) * 100, 2)
             END
                AS Pass_2nd_percent,
             CASE
                WHEN Total = 0 OR Pass_3rd = 0 THEN 0
                ELSE ROUND (Pass_3rd / (Total) * 100, 2)
             END
                AS Pass_3rd_percent,
             CASE
                WHEN Total = 0 OR DNM = 0 THEN 0
                ELSE ROUND (DNM / (Total) * 100, 2)
             END
                AS DNM,
             CASE
                WHEN Total = 0 OR Incomplete = 0 THEN 0
                ELSE ROUND (Incomplete / (Total) * 100, 2)
             END
                AS Incomplete
        FROM (  SELECT hub,
                       SUM (DECODE (result, ''Pass_on_1st'', 1, 0)) Pass_1st,
                       SUM (DECODE (result, ''Pass_on_2nd'', 1, 0)) Pass_2nd,
                       SUM (DECODE (result, ''Pass_on_3rd'', 1, 0)) Pass_3rd,
                       SUM (DECODE (result, ''DNM'', 1, 0)) DNM,
                       SUM (DECODE (result, ''INCOMPLETE'', 1, 0)) Incomplete,
                         SUM (DECODE (result, ''Pass_on_1st'', 1, 0))
                       + SUM (DECODE (result, ''Pass_on_2nd'', 1, 0))
                       + SUM (DECODE (result, ''Pass_on_3rd'', 1, 0))
                       + SUM (DECODE (result, ''DNM'', 1, 0))
                       + SUM (DECODE (result, ''INCOMPLETE'', 1, 0))
                          Total
                  FROM employees_vw a, pse_vw b
                 WHERE     a.emplid = b.emplid
                       AND status IN (''S'', ''I'', ''N'')
                       AND TYPE = ''PSE''
       report_query_b   VARCHAR2 (10000)
                           := ' 
    SELECT hub,
           TYPE,
           subtype,
           CASE
              WHEN Total = 0 OR Pass_1st = 0 THEN 0
              ELSE ROUND (Pass_1st / (Total) * 100, 2)
           END
              AS Pass_1st_percent,
           CASE
              WHEN Total = 0 OR Pass_2nd = 0 THEN 0
              ELSE ROUND (Pass_2nd / (Total) * 100, 2)
           END
              AS Pass_2nd_percent,
           CASE
              WHEN Total = 0 OR Pass_3rd = 0 THEN 0
              ELSE ROUND (Pass_3rd / (Total) * 100, 2)
           END
              AS Pass_3rd_percent,
           CASE
              WHEN Total = 0 OR DNM = 0 THEN 0
              ELSE ROUND (DNM / (Total) * 100, 2)
           END
              AS DNM,
           CASE
              WHEN Total = 0 OR Incomplete = 0 THEN 0
              ELSE ROUND (Incomplete / (Total) * 100, 2)
           END
              AS Incomplete
      FROM (  SELECT hub,
       TYPE,
           subtype
                      SUM (DECODE (result, ''Pass_on_1st'', 1, 0)) Pass_1st,
                       SUM (DECODE (result, ''Pass_on_2nd'', 1, 0)) Pass_2nd,
                       SUM (DECODE (result, ''Pass_on_3rd'', 1, 0)) Pass_3rd,
                       SUM (DECODE (result, ''DNM'', 1, 0)) DNM,
                       SUM (DECODE (result, ''INCOMPLETE'', 1, 0)) Incomplete,
                         SUM (DECODE (result, ''Pass_on_1st'', 1, 0))
                       + SUM (DECODE (result, ''Pass_on_2nd'', 1, 0))
                       + SUM (DECODE (result, ''Pass_on_3rd'', 1, 0))
                       + SUM (DECODE (result, ''DNM'', 1, 0))
                       + SUM (DECODE (result, ''INCOMPLETE'', 1, 0))
                          Total
                  FROM employees_vw a, pse_vw b
                 WHERE     a.emplid = b.emplid
                       AND status IN (''S'', ''I'', ''N'')
                     AND TYPE = ''PSE''
       report_query     VARCHAR2 (10000);
    BEGIN
       IF v_hub <> '*'
       THEN
          report_query := report_query_a;
       ELSE
          report_query := report_query_b;
       END IF;
       IF v_hub <> '*'
       THEN
          report_query :=
             report_query || ' and hub = ''' || v_hub || ''' GROUP BY hub )
    GROUP BY hub,
             Pass_1st,
             Pass_2nd,
             Pass_3rd,
             Total,
             DNM,
             Incomplete';
       END IF;
       IF v_type <> '*' AND v_subtype <> '*' AND v_hub <> '*'
       THEN
          report_query :=
                report_query
             || ' and hub = '''
             || v_hub
             || ''' and type = '''
             || v_type
             || ''' and subtype= '''
             || v_subtype
             || '''
              GROUP BY hub,
                     TYPE,
                     subtype,
            GROUP BY hub,
                     TYPE,
                     subtype,
                     Pass_1st,
                     Pass_2nd,
                     Pass_3rd,
                     Total,
                     DNM,
                     Incomplete';
       END IF;
       OPEN retval FOR report_query;
       RETURN retval;
    END;
    Edited by: user10821012 on May 13, 2010 9:56 AM

    What you are seeing is pretty common. When I work with dynamic SQL I usually include some logic to put the dyanmic SQL into a string and a means to see what was generated, something like (untested here)
      v_sql_c := 'select * from dual';
      open refcur for v_sql_c;
    exception
      when others then
         insert into work_table (clob_column) values (v_sql_c);so I can later query the table to get to the generated SQL for debugging, something like
      select * from work_table;I also try to write dynamic SQL so I can paste it from the work table right into query execution without editing.

  • Problem when calling a return type BOOLEAN SQL Function in a package

    Hi All,
    I am having problem when trying to call a SQL function in a package with return type BOOLEAN
    The SQL function signature is as follows
    CREATE OR REPLACE PACKAGE RMSOWNER.ORDER_ATTRIB_SQL ****
    FUNCTION GET_PO_TYPE_DESC(O_error_message IN OUT VARCHAR2,
    I_PO_TYPE       IN     VARCHAR2,
    O_PO_TYPE_DESC  IN OUT VARCHAR2)
    RETURN BOOLEAN;
    Following is my java code
    +CallableStatement cs3 = conn.prepareCall("{?=call ORDER_ATTRIB_SQL.GET_PO_TYPE_DESC(?,?,?)}");+
    +cs3.registerOutParameter(1, java.sql.Types.BOOLEAN);+
    +cs3.registerOutParameter(2, java.sql.Types.VARCHAR);+
    +cs3.registerOutParameter(4, java.sql.Types.VARCHAR);+
    +cs3.setString(2, "");+
    +cs3.setString(3, "ST");+
    +cs3.setString(4, "");+
    +ResultSet rs3 = cs3.executeQuery();+
    I get the following exception, i tried changing the sql type(registerOutParameter) from boolean to bit but i still getting this exception.
    But when i call any other functions with return type other than boolean they work perfectly fine.
    Please can anyone help me fix this issue, i am not sure if its anything to do with vendor JDBC classes?
    +java.sql.SQLException: ORA-06550: line 1, column 13:+
    +PLS-00382: expression is of wrong type+
    +ORA-06550: line 1, column 7:+
    +PL/SQL: Statement ignored+
    +     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)+
    +     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)+
    +     at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)+
    +     at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)+
    +     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)+
    +     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)+
    +     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)+
    +     at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)+
    #####

    Hello People!
    There is another workaround!!
    See the example below:
    private String callBooleanAPi(String tableName,String apikey,String dtInicio,String dtFim,String comando) throws SQLException {
                   CallableStatement cs = null;
                   String call = "";
                   String retorno = null;
                   try {
                        if(comando.equalsIgnoreCase("INSERT")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x :=PKG.INSERT(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        } else if(comando.equalsIgnoreCase("UPDATE")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.UPDATE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        } else if(comando.equalsIgnoreCase("DELETE")){
                             call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.DELETE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
                        cs = conn.prepareCall(call);
                        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
                        SimpleDateFormat sdfToSqlDate = new SimpleDateFormat("yyyy-MM-dd");
                        java.util.Date dataInicialVigencia =null;
                        java.util.Date dataFinalVigencia = null;
                        Date dtInicialFormatada =null;
                        Date dtFinalFormatada = null;
                        if(dtInicio != null && !dtInicio.equals("")){
                             dataInicialVigencia = sdf.parse(dtInicio);
                             dtInicio =sdfToSqlDate.format(dataInicialVigencia);
                             dtInicialFormatada = Date.valueOf(dtInicio);
                        if(dtFim != null && !dtFim.equals("")){
                             dataFinalVigencia = sdf.parse(dtFim);
                             dtFim =sdfToSqlDate.format(dataFinalVigencia);
                             dtFinalFormatada = Date.valueOf(dtFim);
                        cs.setString(1, tableName);
    cs.setString(2, apikey);
    cs.setDate(3, dtInicialFormatada );
    cs.setDate(4, dtFinalFormatada );
    cs.registerOutParameter(5, java.sql.Types.VARCHAR);
    cs.registerOutParameter(6, java.sql.Types.VARCHAR );
    cs.execute();
                        retorno = cs.getString(6);
                        System.out.println( cs.getString(5));
                   } catch(SQLException e){
                   throw new SQLException("An SQL error ocurred while calling the API COR_VIGENCIA: " + e);
                   } catch(Exception e){
                   Debug.logger.error( "Error calculating order: " + id, e );
                   } finally {
                   if (cs != null) {
                   cs.close();
                   cs = null;
                   return retorno;
    As you can see the CallableStatement class acepts PL/SQl blocks.
    Best Regards.

  • PL/SQL Local Debug restricting ports

    Does anyone know how to restrict the ports used by the PL/SQL local debugger?

    Shay,
    It's not working that way for me. When I open up the PL/SQL function in the editor and then right click within the editor and choose debug, I'm presented with a dialog window titled "Debugger Host for Database Debugging".
    This box has only one input control (IP address) and the following text:
    "If JDeveloper is running on a machine in a VPN, enter the IP address of the machine as it is known to the rest of the VPN."
    I've tried the default, "127.0.0.1", my IP address and even the IP address of the machine running the Oracle DB.
    All three of these choices yield the following results:
    =======================================================
    Connecting to the database QF.
    Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
    Executing PL/SQL: ALTER SESSION SET PLSQL_COMPILER_FLAGS=INTERPRETED
    Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '10.69.35.11', '1544' )
    ORA-30683: failure establishing connection to debugger
    ORA-12541: TNS:no listener
    ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
    ORA-06512: at line 1
    Process exited.
    Disconnecting from the database QF.
    =======================================================
    Thanks,
    Greg

  • Passing Multiple Values from a worksheet to PL/SQL function.

    Hi All,
    Is there any way to pass multiple values selected in a worksheet to a PL/SQL function ?
    I will try to explain the scenario:
    We have a crosstab report that showing all the customer details, deposit sum of a customer in each date in a date range selected. With the customer details we are showing the Rank of a customer based on the deposit in the latest date selected. Filtering is based on the rank, ie Top50 or Top60 etc.( As I said rank is calculating based on the deposit in the latest date).This is working fine.
    Now the new requirement is to : For example, in Top50 report, list all the customers, who were in the Top50 list, in any of the dates selected. We are able to display the daywise rank, but when giving a condition like daywiserank <= 50, the result becomes uncertain. Some blank lines, wrong amounts etc..
    As a work around we tried to find out the rank in a PL/SQL function. But the issue there is : we have some multiple value parameters used in the worksheet.
    Is there any way to pass multiple values selected in a worksheet to a PL/SQL function ?
    Or any other work arounds for the scenario explained?
    Reagrds,
    Jeneesh

    Hi Russ,
    Thanks for the response.
    Russ Proudman wrote:
    1. I thought there was an analytical function similar to rank - or maybe an option of rank - that if there are duplicate records to have them all considered the same rank. So if you had 3 records all the same as rank=2 then a condition saying where rank=2 would return the 3 records. You could check into this.
    We are already using DENSE_RANK. But the issue is the output contains incorrect null values nd repeated rows.
    We got it solved as I explained in the previous post. But will that AGGREGATION MODE setting ( Which discoverer says - not recommended) have any issue? I mean side effects?
    Russ Proudman wrote:
    2. Another thought is that you can create a PL/SQL routine - that's called from a SQL function registered in Discoverer - where a table is created that does the first part of your query. Then a worksheet is created to use the data from that table. So, in essence, the table would have your top50 ranked customers. Then you can write any kind of worksheet against that table. However, DBAs are loath to allow tables - that they didn't create! - many times in a PROD environment.
    Here also the same problem will occur: as the top 50 will depend upon the parameters. I cannot pass those parameters to PL/SQL Function.And storing the top50 ( itmay be top100 or to 150 also) for all combinations of the parameters is impossible
    Russ Proudman wrote:
    3. Finally, are you sure you're rank function is correct in that if you're getting blank lines, maybe the 'over' part is not considering all columns needed to determine the rank?
    Yes the query we are using is correct. The output QUERY of discoverer gives correct results in Sqlplus.
    Regards,
    Jeneesh

  • Show refcursor returned by a PL/SQL function ?

    Is it possible to show the results returned by a
    PL/SQL function that returns a refcursor ?
    In sqlplus it goes like this:
    SQL> variable a refcursor;
    SQL> execute :a := p_front.get_invoice_list;
    PL/SQL procedure successfully completed.
    SQL> print a;
    INVOICE_ID CLIENT_ID INVOICE_D
    101 100 01-APR-06
    100 100 06-APR-06
    If not, this would be on the top of my wishlist...
    By the way: you did a good job on this tool!
    Regards,
    Willem

    Is it possible to show the results returned by a
    PL/SQL function that returns a refcursor ?
    In sqlplus it goes like this:
    SQL> variable a refcursor;
    SQL> execute :a := p_front.get_invoice_list;
    PL/SQL procedure successfully completed.
    SQL> print a;
    INVOICE_ID CLIENT_ID INVOICE_D
    101 100 01-APR-06
    100 100 06-APR-06
    If not, this would be on the top of my wishlist...
    By the way: you did a good job on this tool!
    Regards,
    Willem

  • Application Report Missing PL/SQL Functional Area

    All,
    I just wanted to bring to the ApEx developers something I just noticed... I use the Shared Components > Database Object Dependencies report to make sure all is well before moving applications into production.
    The Parsing Errors feature of that report is WONDERFUL! But it seems to be overlooking buttons that use a conditional display based on PL/SQL Function Body Returning a Boolean.
    Dan

    Hi Dan,
    I think the place is perfect, but I read once somewhere that "Bug" or "Bug Report" should be in the subject so that's easier to find for the Oracle guys.
    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/

  • Interactive report from PL/SQL function

    Hello All,
    i have a pl/sql function that dynamically builds up a sql query and returns it as a varchar2.
    when i create a new report then i can use this function in the report like
    return f_function(param1,param2,v('APP_ID'), v('APP_SESSION'));
    and this works fine.
    Except i cannot create an interactive report for this function, because it is not allowed !!!!
    So how can i use the function in an interactive report ?
    Thanks in advance,
    Marco

    Marco,
    Another rather extreme approach would be to go all the way and make your function pipelined (that is not only build but also execute the query) and then select from it in your interactive report.
    The disadvantage here would be that any supplementary filtering would act on the result set of the function (not as an addition to the where clause of the original query). But if you can live with that...
    The advantage would be that there's less fiddling with column headers.
    Regards,
    Iulian

  • Interactive Report with PL/SQL Function Source

    Is it possible to create interactive report with PL/SQL function source returing a query? If not, has anyone done any work to simulate the interactive reporting feature for a normal report using API?

    I haven't tried that before but you could:
    1. create a collection from your result set returned by a dynamic query,
    2. create a view on that collection,
    3. use the view in your interactive report.
    The usability of this proposal depends from a question how "dynamic" your query is - does it always have the same number of columns or not.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

Maybe you are looking for

  • Ringtone sounds not working correctly

    I don't know what happened to the ringtone sounds on my iPhone 3gs. I'm wondering if there's something wrong in the settings.

  • HT2508 airport Express not working in Mountain Lion

    My old airport express stopped working properly since I loaded Mountain Lion.  I purchased a new Airport Express and it will work, but the audio fades in and out.  I am connected from the airport express unit to my audio receiver via a 3.5 out into R

  • Catching policy file errors in try/catch

    Hi, I have a socket policy server that works just fine. If however the page is loaded and the socket policy server isn't running, I want to be able to catch the error. Here is an example: try{      Security.loadPolicyFile("xmlsocket://127.0.0.1:9876"

  • Unity's Connection with Exchange Mailboxes

    We are migrating to a new child domain of a new forest. In the first phase of the move we are migrating our Exchange cluster. The plan was to install our Unity server into the new domain two weeks before we actually cut over our users. We are restori

  • What version of Photoshop to use?

    Hello, I "used to be" a professional photographer but am now retired.  I would like to get into using Photoshop but don't know what version to use.  Can someone help?  I have an HP w/AMD Athlon II X4 640 Processor w/6GB RAM and all the bells & whistl