Validation - PLSQL function Boolean return bug?

Request Express 4.1.1.00.23 (and all earlier versions I've ever used)

When you use the wizard to create a Validation of type "Function PLSQL return Boolean", why is - this mandatory to enter a value in the field "Error" on the screen that follows? This message is never used because the message actually comes from a PLSQL return statement.
PaulP

Hello

Well, there is still this red asterisk, you cannot enter anything in the text of the error.
If you leave the field blank, Assistant does not raise any validation error.

I think that asterisk is just because they have reuse same wizard page.

Kind regards
Jari
-----
My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
Twitter: http://www.twitter.com/jariolai

Tags: Database

Similar Questions

  • PLSQL function to return the result of the query

    Dear all,

    Oracle Database SE1 11.2.0.1

    I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.

    Is this possible?

    Madhu.149 wrote:

    I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.

    Be careful - results games indicate a set of data stored in memory. This is not what are sliders. This isn't how Oracle should be used.

    Imagine that you implement such a result set function - which, on average, requires 1 MB of memory (private server) to store the results of the SQL query. A 100 users mean a 100 MB of memory required server. This is not suitable. Not at all. Never.

    The correct back 'thing' is a handle to SQL cursor (called a ref cursor in this case). A SQL cursor is a "program" - that the appellant runs via the fetch command and generates one or more lines accordingly. Appellant repeatedly runs this slider through calls to fetch until this slider found and returns all rows affected (using consistent readings).

    If you want an abstraction interface that the client can call via PL/SQL code in the database, so this crafting optimal SQL interface, creates the SQL cursor and returns the handle of the cursor (via the ref cursor data type) to the client.

  • Field validation through pl/sql returning a Boolean

    Hello

    I do a validation of date entered based on a value in the other field of the form.  The function returns Boolean values (TRUE / FALES) based on the date of entry if it falls within the specific range of dates.

    Here is the example.

    img 2.png

    However, after sending them, I get the error message like -.

    Processing of validation error.

    ORA-06550: line 1, column 44: PLS-00221: 'F_CHECK_DATE' is not a procedure or is undefined ORA-06550: line 1, column 44: PL/SQL: statement ignored

    I'm doing something wrong here?  Help, please.

    Thank you

    -Anand

    anand_gp wrote:

    Hello

    I do a validation of date entered based on a value in the other field of the form.  The function returns Boolean values (TRUE / FALES) based on the date of entry if it falls within the specific range of dates.

    Here is the example.

    However, after sending them, I get the error message like -.

    Processing of validation error.

    ORA-06550: line 1, column 44: PLS-00221: 'F_CHECK_DATE' is not a procedure or is undefined ORA-06550: line 1, column 44: PL/SQL: statement ignored

    I'm doing something wrong here?  Help, please.

    Thank you

    -Anand

    The index is in the validation type: function returning a Boolean

    The expression of validation for validation of Boolean function return must be in the form of a function with at least one accessible body return statement that returns a Boolean value:

    ...

    return ;

    or

    return to_date(:p11_event_date, 'DD/MM/YYYY') > sysdate;


    in this case:

    return my_package.f_check_date(:p11_season, :p11_event_date);

    However, because the function returns a Boolean value anyway, you might as well use a validation Of PL/SQL Expression and save some typing:

    my_package.f_check_date (: p11_season,: p11_event_date);

  • Go to a function that returns a Boolean

    Short version of the question: Boolean values can be returned by a pl/sql function?

    I've implemented a short function which returns a Boolean value; When I compile it I get an error:

    Error report:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 6, column 4:

    PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.

    ORA-06550: line 6, column 4:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    The closest, I appealed


    RETURN sys.diutil.bool_to_int (< foo >);


    and then a caller script can call


    sys.diutil .int_to_bool (< bar >);

    at least this way there is no verification of the Boolean value of 'manual '.  Is it really the only way to return / call a Boolean?


    Thank you

    Chris


    EDIT


    I was aware of the fact I had not provided examples of code - and was just one question fairly open. I hope that this example will show what does not work!


    I have a function that returns a Boolean value:


    create or replace

    FUNCTION myFunc (s_in IN VARCHAR2) RETURN a Boolean value

    IS

    s_out BOOLEAN: = TRUE;

    BEGIN

    RETURN s_out;

    END FUNCTION3;

    I try and call the function in the following script:

    DECLARE

    s_in varchar2 (20): = "Hello";

    s_out boolean;

    BEGIN

    SELECT myfunction (s_in) INTO s_out FROM DUAL;

    END;

    That's when I get the error. But sorry, I was looking for too many error messages! I have worked that the one I posted above is because put_line can accept only strings and numbers not Boolean, the mistake that this function returns is:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 5, column 11:

    PLS-00382: expression is of the wrong type

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    However, I suppose that the comment of Frank Kulash is perhaps the reason why I see this?


    Post edited by: 2922851

    Hi, Chris,.

    2922851 wrote:

    Short version of the question: Boolean values can be returned by a pl/sql function?

    Sure.  If you are having problems, post your code (both the function and some PL/SQL that calls it).

    The BOOLEAN data type exists only in PL/SQL, not in SQL, so if the function returns a BOOLEAN value, then you can't call it in a SQL statement, even if this SQL statement is used within PL/SQL.  For this reason, a lot of guys write functions that return a NUMBER (1 or 0) or a string (' t ' or 'F') rather than return a BOOLEAN value.

    I've implemented a short function which returns a Boolean value; When I compile it I get an error:

    Error report:

    ORA-06550: line 5, column 32:

    PLS-00382: expression is of the wrong type

    ORA-06550: line 6, column 4:

    PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.

    ORA-06550: line 6, column 4:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    This error indicates a problem calling put_line; It has nothing to do with what returns the function.

  • ORA 28817 PLSQL function returned an error. When the apex 4 2 instance access

    Hello

    I just upgraded from apex to apex 4.2 4.1. All is well except for this error I get when I try to access the parameter Instance on the App Admin (localhost/apex/apex_admin)
    ORA-28817: PL/SQL function has returned an error
    What could be the problem? How we solve this problem...

    I'm working on the 2012 Win server machine... apex 4.2 with earphone 2 deployed on Glassfish 3.1.2 apex.

    Best regards
    Fateh

    Hello Faye,

    We are already aware of this problem, even if it is not yet present on our Web page of problems known. The reason for this error is that the new facility replaces an instance to the scale encryption key. In the preferences of the instance which have been encrypted with the old value (the SMTP password and the password for the portfolio), the values are not valid after the upgrade and decryption causes this error. As a work around, you can use the apex_instance_admin package to replace the invalid passwords.

    The following code shows how the decryption throws ORA-28817:

    SYS@a411> select apex_instance_admin.get_parameter('SMTP_PASSWORD') from dual;
    select apex_instance_admin.get_parameter('SMTP_PASSWORD') from dual
           *
    ERROR at line 1:
    ORA-28817: PL/SQL function returned an error.
    ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
    ORA-06512: at "SYS.DBMS_CRYPTO", line 44
    ORA-06512: at "APEX_040200.WWV_FLOW_CRYPTO", line 89
    ORA-06512: at "APEX_040200.WWV_FLOW_INSTANCE_ADMIN", line 239
    

    You can fix this by entering new password:

    SYS@a411> exec apex_instance_admin.set_parameter('SMTP_PASSWORD','my smtp password');
    PL/SQL procedure successfully completed.
    
    SYS@a411> exec apex_instance_admin.set_parameter('WALLET_PWD','my wallet password');
    PL/SQL procedure successfully completed.
    
    SYS@a411> select apex_instance_admin.get_parameter('SMTP_PASSWORD') from dual;
    APEX_INSTANCE_ADMIN.GET_PARAMETER('SMTP_PASSWORD')
    ----------------------------------------------------------------------------------------------
    my smtp password
    
    1 row selected.
    

    Kind regards
    Christian

  • This plsql function is considered ok?

    This plsql function is considered ok?  The reason that I ask is that the results are different when called within a packet vs appeal during a procedure.  I don't know if this is a bug or if it is illegal.

    CREATE OR REPLACE package body test as
    
    function test return varchar2 is
    begin
    htp.prn('ABCDEF');
    return 'xyz';
    end;
    
    
    end;
    
    
    

    When this function is called inside a package, the string 'ABCDEF' will appear out of sequence.   I think it's because of the in-Lining, 11 g the function at compile time.

    Whereas, when the function is called during a procedure the string 'ABCDEF' appears in the browser html properly.

    The service is technically do stuff how to output data from htp.prn, then Oracle can judged illegal.  I have a very good reason for wanting this feature, so before you take a different approach, I wanted to ask around.

    The question is how the statements are executed by the PL/SQL engine.

    Consider the statement:

    HTP.p (' test1 ' |)  FuncTest() ' | 'test2');

    To run it, all nested 'objects' must be resolved and executed first. Think of the execution path inside-to-outside.

    If FuncTest() is executed first. He puts a string into the buffer of HTP. The result of the function is concatenated and created a unique string literal. This literal is now the parameter in the call to htp.p (). Who then adds, after FuncTest(), a string to the buffer of HTP.

    I disagree with your statement that it behaves differently in the procedures as packages. I created 3 test cases for the foregoing. Anonymous block (run immediately the text code execution). Individual objects (separate procedure and function). Single object (procedure and function wrapped in a box).

    Each product, as expected, the same result.* how the engine of PL/SQL treats the path of execution of instructions, does not change because the statement is in a packed and not a stand-alone procedure.

    * 11.2.0.2 using SST 11 g Server (Apache v2 and v2 mod_plsql).

  • Back list Java plsql function

    Hi all

    I have the java as code: -.

    
    
    package com.demo.test;
     
    import java.util.ArrayList;
    import java.util.List;
    
    
    
    public class ListTest {
     
      public List<String> getList() {
      List listA = new ArrayList();
     
      listA.add("element 1");
      listA.add("element 2");
      listA.add("element 3");
      listA.add("element 4");
      listA.add("element 5");
      listA.add("element 6");
      listA.add("element 7");
      return listA;
      }
    }
    
    

    I create the function to call java: -.

    create or replace FUNCTION get_list return varchar2 as
    language java name 'com.demo.test.ListTest.getList() return java.lang.String';
    
    

    I want to call above function in plsql and I out like: -.


    Element1

    item2

    3

    Item4

    element5

    element6

    Element7


    Please help me.

    Thank you
    Xandot

    create or replace and compile java source named ListTestSrc as
    package com.demo.test;  
    
    import java.util.ArrayList;
    import java.util.List;
    import java.sql.*;
    import oracle.sql.*; 
    
    public class ListTest {
        public static ARRAY getList() throws SQLException {
            List listA = new ArrayList();
    
            listA.add("element 1");
            listA.add("element 2");
            listA.add("element 3");
            listA.add("element 4");
            listA.add("element 5");
            listA.add("element 6");
            listA.add("element 7");  
    
            Connection conn = DriverManager.getConnection("jdbc:default:connection:");
            ArrayDescriptor dsc = ArrayDescriptor.createDescriptor("VARCHAR2_TABLE", conn);
    
            return new ARRAY(dsc, conn, listA.toArray());
        }
    }
    
    create or replace type varchar2_table as table of varchar2(4000);
    /
    
    create or replace function get_list return varchar2_table as
    language java name 'com.demo.test.ListTest.getList() return oracle.sql.ARRAY';
    /
    
    SQL> select * from table(get_list);
    
    COLUMN_VALUE
    ---------------------------------------
    element 1
    element 2
    element 3
    element 4
    element 5
    element 6
    element 7
    
    7 rows selected.
    

    If you want to use the collection in a SQL query (as above) and if the collection is large, you can do in pipeline.

    See a similar example here: Re: Re: how to select csv data stored in a BLOB column as if it were an external table?

    Otherwise, just use it directly into the PL/SQL code:

    SQL> set serverout on
    SQL>
    SQL> declare
      2    v_list varchar2_table := get_list();
      3  begin
      4    for i in 1 .. v_list.count loop
      5      dbms_output.put_line(v_list(i));
      6    end loop;
      7  end;
      8  /
    element 1
    element 2
    element 3
    element 4
    element 5
    element 6
    element 7
    
    PL/SQL procedure successfully completed.
    
  • Message box in function that returns a list deletes the created list... (Dialog box)

    Hello

    I work with a complex dialogue, its purpose is to manage a section in the PDF file.

    I use a "mclv" object in the dialog box to represent data entries in the PDF file in order to manage the result in another section.

    I created a function that creates the list based on a previous section in the PDF object, the function works perfectly well.

    But I have a small question, the function used to create the list of the dialog box object performs a check with the former front list created, as appropriate,

    and if in any case it is different from the old list, I need to warn the user that the list has changed and if there were any changes applied to the result it will be returned to zero and must be recreated.

    But when the poping that message box, all lists are deleted and nothing is displayed in the objects 'mclv.

    If I remove the message box, the lists are all very well...

    Is there anyone who have come across something like this before? If so, any solution to this problem?

    I asked my question a bit too quickly, I already found a work around

    But I still don't understand why he behaves like that tho...

    I just thought how to work around this problem.

    If anyone has encountered this problem can use this solution:

    Instead of having the message inside the function to return box, I declared a global Boolean variable to the Script object

    If the message box must be displayed, the Boolean value is set to True

    Once in the initialize event of the dialog box, if the value Boolean true I call the message box and reset the value Boolean false

  • function to_numer returns the error in pl/sql

    Hello
    I don't have a prob when executing select double to_number('1234.56'), the numer contains decimal numbers
    But this stm return number not valid error in the procedure, except if I use to_number('1234.56','9999999.99')
    Please help me.
    I need to set parameter in DB?
    BTW: my NLS_NUMERIC_CHARACTER has the value '.,'
    Thank you.

    function to_numer returns the error in pl/sql

    hlthanh wrote:
    Hello
    I don't have a prob when executing select double to_number('1234.56'), the numer contains decimal numbers
    But this stm return number not valid error in the procedure, except if I use to_number('1234.56','9999999.99')
    Please help me.
    I need to set parameter in DB?
    BTW: my NLS_NUMERIC_CHARACTER has the value '.,'
    Thank you.

    Handle: hlthanh
    Status level: Beginner
    Join date: March 7, 1999
    Messages total: 94
    Total Questions: 60 (38 pending)
    many questions and so few answers.
    How SAD!

  • error in calculation PLSQL function

    Hi friends,

    I have the plsql function below that throw error.

    The function below is written in Apex, if kindly let me know how to solve this error

    The following query checks the existing value and null assigns a value to the select statement. otherwise will assign it to the variable. I don't get how to set dynamically using the select statement

    Function:

    BEGIN
    IF
    : P1_VARIABLE_NAME IS NULL THEN: P1_VARIABLE_NAME: = select... from... (which returns a string)
    ON THE OTHER
    : P1_VARIABLE_NAME
    END
    END

    Error:

    Met the "SELECT" symbol when awaits one of the following numbers: (- + case mod new avg not null current County exists prior min max sql stddev sum variance execute forall time timestamp interval date fusion pipe)

    Hi Pradeep,

    Have you used the suggestion in the post above?
    (Do not use the PL/SQL only the suggested above query block)
    Did you put a semicolon after the query?
    And you always use the PL/SQL code?

    Could you post details of calculation?

    Kind regards
    Kiran

  • Function that return the name of the current report

    Hello

    Anyone know if there is a function that returns the name of the current report?, similar to GET_APPLICATION_PROPERTY (CURRENT_FORM) in the forms.


    Tnks,


    LEFM

    Hello

    You can use the builtin: SRW. GET_REPORT_NAME
    This function returns the file name of the running report

    http://www.Oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/PLSQL/builtins/SRW/srw_get_report_name.htm

    NOTE: it is not the name of the RDF file. Is the name defined in the reporting name property.

    Concerning

  • ERR-9131 error in the body of PLSQL function for default code point, the point =

    Hi all


    I am filling a field element of text in two different ways, but on the same page:

    1 - the page is called to change the values inside-> value of the element comes from field of database

    2 - the page is called to insert new values-> value of the element comes from a calculated function that returns a default value

    Point features:

    Source->

    always replace any existing value in session state

    database column

    -> Default

    -----------------------------------------------------------------------------------------------------------------------------
    default value
    ------------------------------------------------------------------------------------------------------------------------------
    DECLARE
    NUMBER OF THE LINHA;
    gene number;
    i_emp varchar2 (32000);
    v_sql2 varchar2 (32000);
    BEGIN
    i_emp: =: P62_EMP_COD;

    IF: P62_RDD_LIN IS NULL THEN
    LINHA: = 1;
    ON THE OTHER
    LINHA: =: P62_RDD_LIN;
    END IF;

    v_sql2: =' select '. i_emp |'. Grh_1_utils. GRHFU_RUB_DEFAULT ('|: P62_ENT_COD |', 'R' ' |: P62_REM_COD |', 1, 1000000, to_date null, "D", ("' |: P62_DAT_INI |")) (', "DD/MM/YYYY"),' | LINHA |') the double ';

    EXECUTE IMMEDIATE v_sql2 INTO gene;
    COMMIT;

    return deciphered;
    end;
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    default value - body of the PL/SQL function




    The error I get is:



    ORA-00936: lack of expression

    ERR-9131 error in PLSQL function for default code point body, item = ITEM_TO_POPULATE



    Something is wrong with my function or is a different, better way to do this?


    Cordially Pedro.

    Hello

    You can do some tests?
    (1) try to make this code first (to make sure that the P62_EMP_COD is not null when running):

    DECLARE
    LINHA NUMBER;
    defeito number;
    i_emp varchar2(32000);
    v_sql2 varchar2(32000);
    BEGIN
    i_emp := :P62_EMP_COD;
    
    IF :P62_RDD_LIN IS NULL THEN
    LINHA:=1;
    ELSE
    LINHA := :P62_RDD_LIN;
    END IF;
    
    v_sql2:='select '||i_emp||'.Grh_1_utils.GRHFU_RUB_DEFAULT('||:P62_ENT_COD||',''R'','||:P62_REM_COD||', 1 , 1000000,''D'',null,to_date('''||:P62_DAT_INI||''',''DD/MM/YYYY''),'||LINHA||') from dual';
    
    EXECUTE IMMEDIATE v_sql2 INTO defeito;
    COMMIT;
    
    return defeito;
    end;
    

    (2) then you can try to change your source, by changing 'replacement always of value that exists in the session state' "only when null.

    (3) enter your variable dynamic SQL code and check it out:

    DECLARE
    LINHA NUMBER;
    defeito number;
    i_emp varchar2(32000);
    v_sql2 varchar2(32000);
    BEGIN
    i_emp := :P62_EMP_COD;
    
    IF :P62_RDD_LIN IS NULL THEN
    LINHA:=1;
    ELSE
    LINHA := :P62_RDD_LIN;
    END IF;
    
    v_sql2:='select '||i_emp||'.Grh_1_utils.GRHFU_RUB_DEFAULT('||:P62_ENT_COD||',''R'','||:P62_REM_COD||', 1 , 1000000,''D'',null,to_date('''||:P62_DAT_INI||''',''DD/MM/YYYY''),'||LINHA||') from dual';
    return v_sql2;
    EXECUTE IMMEDIATE v_sql2 INTO defeito;
    COMMIT;
    
    return defeito;
    end;
    

    (4) prevent your run immediate code of SQL Injections using the link:

    DECLARE
    LINHA NUMBER;
    defeito number;
    i_emp varchar2(32000);
    v_sql2 varchar2(32000);
    BEGIN
    i_emp := :P62_EMP_COD;
    
    IF :P62_RDD_LIN IS NULL THEN
    LINHA:=1;
    ELSE
    LINHA := :P62_RDD_LIN;
    END IF;
    
    v_sql2:='select '||i_emp||'.Grh_1_utils.GRHFU_RUB_DEFAULT(:1,''R'',:2, 1 , 1000000,''D'',null,to_date(:3,''DD/MM/YYYY''),:4) from dual';
    
    EXECUTE IMMEDIATE v_sql2 INTO defeito USING :P62_ENT_COD, :P62_REM_COD, :P62_DAT_INI, LINHA;
    COMMIT;
    
    return defeito;
    end;
    

    Best regards, Kostya Proskudin

  • Looking for an example of "function that returns the error text.

    Environment: APEX 3.1.1.00.09 on AIX 5.3

    I'm looking for an example implementation of the posting of the "function that returns the error text.

    I would like to write a database function that does the validation logic and return the text of the error.

    Is it possible to create multiple lines of text of error based on error conditions?

    I'm trying to use it at the end of the input data to go on the set of the 'document' to the entry and highlight all error conditions encountered before the 'document' is subject to additional processing.

    I wrote the function and reference it in a posting as ' validate_stuff (: P3_DOC_SEQ); »

    I have an error message "validate_stuff is not a procedure or is not defined.

    The object is a function, not a procedure. It is defined to return a parameter VARCHAR2 hoped posting if it is not NULL.

    When I run the SQL function * more and spend in a number of documents are returned the correct error messages.

    Any direction is greatly appreciated.

    -gary

    Hi Gary,.

    You must RETURN the result of the function:

    BEGIN
     RETURN validate_stuff(:P3_DOC_SEQ);
    END;
    

    Andy

  • REP-0737: must be a function of return type 'ref cursor.

    Hi all

    I have create a ref cursor query in reports 10 g. But it is giving error REP-0737: must be a function of return type 'ref cursor.

    Here is my code

    function QR_1RefCurDS return sys_refcursor is
    
     My_Cur Sys_Refcursor;
    begin
      Open My_Cur for select * from scott.emp order by deptno;
      return My_Cur
    end;
    

    fate of the screen.

    Ref_Cursor_in_reports10g.jpg

    Oracle Forms/Reports has a complete PL/SQL engine and (only) the SQL parser.

    However, the engine of forms/States PL / SQL and SQL Analyzer are at a level that was in the Oracle 8.0 database.

    So, in the forms/States functions/procedures and forms/States triggers, you can not use SQL commands that did not exist in the 8.0 database.

    The predefined SYS_REFCURSOR type is introduced in Oracle 9i.

    Use this:

    PACKAGE test_rc IS

    TYPE of rc_type IS REF CURSOR RETURN emp % ROWTYPE;

    END;

    FUNCTION RETURN QR_1RefCurDS Test_rc.rc_type IS

    test_rc.rc_type RC;

    BEGIN

    OPEN the RC to SELECT * FROM emp;

    RETURN rc;

    END;

    Kind regards

    Zlatko

  • How to report o create crosstab in plsql function?

    Hello

    I want to create a function that question of including pivot table. What should be included, I'm using (cursor, folder,...)?

    I transformed under code in link below for my project, but I didn't know where to put a block.

    Example,

    where I put or write the pivot block?

    where can I write declare function block?

    Thank you for taking the time, have a good day

    -----------------------------------------------------------------------------------------

    Sum of the PIVOT queryl online

    SELECT decode(GROUPING(emea) + GROUPING(lad) + GROUPING(apac) + GROUPING(nas) + GROUPING(japan), 5, 'TOTAL', kn) kn,
           SUM(emea) emea,
           SUM(lad) lad,
           SUM(apac) apac,
           SUM(nas) nas,
           SUM(japan) japan,
           SUM(emea) + SUM(lad) + SUM(apac) + SUM(nas) + SUM(japan) AS total
      FROM ((SELECT kz.kz_name AS kn, rl.region AS re, kr.amount AS am
               FROM region_lookup rl, kz_name_lookup kz, kz_reg kr
              WHERE rl.region_id = kr.region_id
                    AND kz.kz_name_id = kr.kz_name_id)
            pivot(SUM(am) FOR re IN ('EMEA' AS emea, 'LAD' AS lad, 'APAC' AS apac, 'NAS' AS nas, 'JAPAN' AS japan))) t
    GROUP BY GROUPING SETS((kn, emea, lad, apac, nas, japan),())
    ORDER BY GROUPING(t.kn), t.kn;

    You can declare a function that returns a ref cursor, then get Java to navigate the cursor until there finishes

    sys_refcursor function MyCursorFunc is

    vCur sys_refcursor;

    Start

    Open vCur for

    SELECT decode (GROUPING (emea) GROUPING (FDA) + GROUPING (apac) + GROUPING (SIN) + GROUPING (japan), 5, 'TOTAL', kn) kn.

    Sum (EMEA) emea,

    Sum (FDA) boy,

    Sum (APAC) apac,

    Sum (SIN) Sin,

    Sum (Japan) Japan,

    Sum (EMEA) + SUM (FDA) + SUM (apac) + SUM (SIN) + SUM (japan) AS total

    OF ((SELECT kz.kz_name AS kn, rl.region LIKE re, kr.amount MOD

    Region_lookup rl, kz_name_lookup kz, kz_reg kr

    WHERE rl.region_id = kr.region_id

    AND kz.kz_name_id = kr.kz_name_id)

    Pivot (Sum (AM) FOR re IN ("EMEA" IN emea, 'BOY' AS a boy, "ACPA" AS apac, "SIN" AS nas "JAPAN" JAPAN))) t

    GROUP BY GROUPING SETS ((kn, emea, lad, apac, nas, japan), ())

    ORDER BY GROUPING (t.kn), t.kn;

    return vCur;

    end;

    How to call here

    or

    Why not just define a view?

    create or replace view V_MyData as

    SELECT decode (GROUPING (emea) GROUPING (FDA) + GROUPING (apac) + GROUPING (SIN) + GROUPING (japan), 5, 'TOTAL', kn) kn.

    Sum (EMEA) emea,

    Sum (FDA) boy,

    Sum (APAC) apac,

    Sum (SIN) Sin,

    Sum (Japan) Japan,

    Sum (EMEA) + SUM (FDA) + SUM (apac) + SUM (SIN) + SUM (japan) AS total

    OF ((SELECT kz.kz_name AS kn, rl.region LIKE re, kr.amount MOD

    Region_lookup rl, kz_name_lookup kz, kz_reg kr

    WHERE rl.region_id = kr.region_id

    AND kz.kz_name_id = kr.kz_name_id)

    Pivot (Sum (AM) FOR re IN ("EMEA" IN emea, 'BOY' AS a boy, "ACPA" AS apac, "SIN" AS nas "JAPAN" JAPAN))) t

    GROUP BY GROUPING SETS ((kn, emea, lad, apac, nas, japan), ())

    ORDER BY GROUPING (t.kn), t.kn

    /

    Then in Java just run a query:

    Select * from V_MyData

Maybe you are looking for