greater than 32 KB in sys_refcursor SQL

Hello
We have to write the function/procedure to form reports in java, there we just bind the recordsets in a grid. We should return the record set as SYS_REFCURSOR.
Most of the sqls participate in rotation and length of the query is so beat 32 k.

Is it possible to move the large sql Ref Cursor?
    CREATE OR REPLACE FUNCTION TESTFUN (pREFCUR OUT SYS_REFCURSOR) RETURN NUMBER
    IS
        vSQLSTR VARCHAR2(32000);
        nRETURN NUMBER;
    BEGIN
        vSQLSTR := ' SQL > 32K ';
        OPEN pREFCUR FOR vSQLSTR;
            RETURN 1;
        EXCEPTION
            WHEN OTHERS THEN
                COMMONEXCEPTIONHANDLER(SQLCODE, SQLERRM); -- log errors which is having RAISE_APPLICATION_ERROR
                RETURN -1;
    END;
Version
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Added Version details
Published by: knksoft on June 7, 2013 06:44

>
using DBMS_SQL I can analyze and execute sqls. But I have to return my output by refcursor. If this is limit PLSql, does perform a work around available?
>
The only option I can think of your Oracle version is:

1. create a function pipeline using DBMS_SQL to create lines for the result set. Here is an example of PIPELINED function; your gathered lines using DBMS_SQL.

CREATE OR REPLACE function get_emp_data
  return emp_table_type
  PIPELINED
  as
   TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
    emp_cv EmpCurTyp;
    l_rec  emp%rowtype;
  begin
    open emp_cv for select * from emp;
    loop
      fetch emp_cv into l_rec;
      exit when (emp_cv%notfound);
      pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
          l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
    end loop;
    return;
  end;
/ 

2. create a simple procedure that opens and returns a REF CURSOR on a call to this procedure in pipeline

OPEN myCursor FOR SELECT * FROM TABLE(get_emp_data);

This "myCursor" would be the REF CURSOR which are returned to the client.

Tags: Database

Similar Questions

  • How a function returning length of characters greater than 4000 selected in SQL

    Hello

    I want to know if there is a way to write a select query on a function call that returns a varchar(8) more of 4,000 characters.

    CREATE OR REPLACE FUNCTION FUNC1

    RETURN VARCHAR2

    IS

    Str VARCHAR2 (32767).

    BEGIN

    Str: = < a string greater than 4000 tank >;

    RETURN str;

    END;

    /

    SELECT FUNC1 of double; -What gives a digital error or value of PL/SQL. Character string buffer too small.

    Is there a way to fix this?

    Thank you

    Hello

    From Oracle 12.1, VARCHAR2s can have up to 32767 bytes in SQL.

    In versions 8.1 at 11, VARCHAR2s can have up to 4000 bytes in SQL.  If you need to pass more PL/SQL, then you must spend a CLOB.

  • list employees whose salary greater than their salary of managers

    Hi all

    I have a requirement.i have two tables emp and dept tables in RPD. I want to get the report as employees whose salary greater than their salary of managers. The report contains empno, ename, salary.

    Please give me any suggesion

    Thanks and greetings

    K.Lavanya

    Are you able to see the table of discipline Manager?

    If Yes, try this

    Criteria - select sal EMP-> filter - > check the box to "convert this SQL filter '.

    Now, you will get

    "EMP". "" SAL "=.

    then add below statement

    "EMP". "' SAL ' > 'MANAGER '. "' SAL '


    Note:

    'MANAGER '. "' SAL ' denoted as wages of new table alias

  • By selecting a row if count is greater than 4

    Hello

    I use Oracle 10.2.0.4.0 version
    CREATE TABLE DMM.QUES
    (
      CASENAME        VARCHAR2(100 BYTE),
      CASENUMBER      VARCHAR2(20 BYTE),
      COVERAGE        VARCHAR2(10 BYTE),
      DIVISIONNUMBER  VARCHAR2(6 BYTE),
      CLASSNUMBER     number,
      TIER            VARCHAR2(2 BYTE),
      MONTHLYRATE     NUMBER
      )
    INSERT orders
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','health', '456J','123',null,.25)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','ee',.45)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','es',.45)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','ec',.46)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','dental', '456J','123','fa',.49)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','life', '456J','123',null,.49)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','life', '456J','123',null,.49)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','life', '456J','123','cc',.34)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','life', '456J','123','dd',.49)
    insert into QUES (CASENAME,CASENUMBER,  COVERAGE,  DIVISIONNUMBER,  CLASSNUMBER,  TIER,MONTHLYRATE)
    values ('ABC','123J','life', '456J','123',null,.55)
    Select * from c
    ABC     123J     health     456J     123          0.25
    ABC     123J     dental     456J     123     ee     0.45
    ABC     123J     dental     456J     123     es     0.45
    ABC     123J     dental     456J     123     ec     0.46
    ABC     123J     dental     456J     123     fa     0.49
    ABC     123J     life     456J     123          0.49
    ABC     123J     life     456J     123          0.49
    ABC     123J     life     456J     123     cc     0.34
    ABC     123J     life     456J     123     dd     0.49
    ABC     123J     life     456J     123          0.55
    Power required
    ABC     123J     health     456J     123          0.25
    ABC     123J     dental     456J     123     ee     0.45
    ABC     123J     dental     456J     123     es     0.45
    ABC     123J     dental     456J     123     ec     0.46
    ABC     123J     dental     456J     123     fa     0.49
    ABC     123J     life     456J     123          0.49
    for a combination of classnumber and coverage, if count is greater than 4 then I must return only one record.
    in the example above 123/Life, we have a number of 5. so I need to show that a single folder and can be any folder.

    Please let me know where I can read on other similar examples.

    Thanks in advance.

    This:?

    SQL> select casename, casenumber, coverage, divisionnumber, classnumber, tier, monthlyrate
      from (select q.*,
                   count (*) over (partition by classnumber, coverage) cnt,
                   row_number () over (partition by classnumber, coverage order by 1) rn
              from ques q)
     where cnt <= 4
        or (cnt > 4
        and rn = 1)
    /
    CASENAME             CASENUMBER                     COVERAGE        DIVISIONNUMBER CLASSNUMBER TIER MONTHLYRATE
    -------------------- ------------------------------ --------------- -------------- ----------- ---- -----------
    ABC                  123J                           dental          456J                   123 fa           .49
    ABC                  123J                           dental          456J                   123 ec           .46
    ABC                  123J                           dental          456J                   123 es           .45
    ABC                  123J                           dental          456J                   123 ee           .45
    ABC                  123J                           health          456J                   123              .25
    ABC                  123J                           life            456J                   123              .55
    
    6 rows selected.
    
  • Increment Dt start with day greater than the Dt at the end of the year Prev in Pro * C

    Morning people and greetings from Toronto.

    I'm trying to change a Pro * C program. Since ages I touched a Pro * C program but I have made an attempt for her. I would probably need some help andhopefully is the right forum I could nto seem to find any section decicated Pro * C programs.

    Here's what its supposed to do. I'm supposed to check if a Start Date of overlap between the start dates and dates from the end of the previous year, and if so, I'm supposed to assign one day Start Date greater than the Date of the end of the previous year.

    I have a control panel that stores records for start date and end Date for each year. Here's what I have for 2010.

    Start date = 8 May 2010 '; End date = may 12, 2011 'year =' 2010 From now the previous record in the table 1 (where the new record is supposed to be inserted) has a record that looks like this:
    DOC_ID     NAME               YEAR         START_DATE     END_DATE
    ------------------------------------------------------------------------------------------------
    999999     Mary Poppins      2009         03-May-2009      08-May-2010
    Now, based on the control table, the Start Date for 2010 coincides with the Date of the end of 2009. In this case, I would need to move the start date = may 9, 2010 "(Date of end + 1)

    Here is my ProC program in hand
    /* Include Headers */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <math.h>
    ---------------------------
    /* Define constants */
    ---------------------------
    #define  nullterm(string) string.arr[string.len] = '\0';
    /* SQL Host Variables */
    exec sql begin declare section;
    exec sql include sqlca;
    
     varchar   ctrl_start_date[11];
     short     ctrl_start_date_ind;
     varchar   ctrl_end_date[11];
     short     ctrl_end_date_ind;
    
     varchar   end_date[11];
     short     end_date_ind;
    
     int       exist_end_date_flag;
     short     exist_end_date_flag_ind;
    
    exec sql end declare section;
    
    
    /* Function Prototypes */
    
    void check_date_overlap();
    
    
    void main(int argc, char *argv[])
    {
    /* Coding starts here */
    
    void get_ctrl_dates()
    {
     exec sql
      select  to_char(trunc(ctrl_start_date),'YYYY/MM/DD'),
              to_char(trunc(ctrl_end_date),'YYYY/MM/DD')
      into    :ctrl_start_date :ctrl_start_date_ind,
              :ctrl_end_date  :ctrl_end_date_ind
      from    control_tb
      where   current_yyyy = :year_number;
    }
    
       check_date_overlap();
    
       if (strcmp( (char *)run_mode.arr,"N")==0)
       {
        check_date_overlap();
        create_person_rec(); /* This will insert record into person_tb table */
       }
    }
    
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date + 1
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date
      having count(*) = 1;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Here would be my question:

    My question is, should the SQL above be written like this instead?
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
        /* Is this even correct or would I have to do a strcpy?.
            Also note that I am overwriting ctrl_start_date which
            was fetched earlier in get_ctrl_dates() */
       ctrl_start_date = end_date + 1;
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Published by: Raj404261 on June 10, 2009 11:21

    You can put your code between the {code}

    As
    {code}
    your code...
    ...
    {code}

    SS

  • ORA-22813: value of the operand is greater than the limits of the system

    Hello
    for small query

    SQL > select COMPLETION_TIME from RC_BACKUP_FILES WHERE ROWNUM < 2;

    I get

    ORA-22813: value of the operand is greater than the limits of the system

    It seems starnge to me, you know?

    I have a great value operand?

    Thanks for help.

    The Version could help here

    might be a bug

  • How to create a default profile for all users of a computer under Windows 7/Vista for Firefox versions greater than 8? I would that all new users on a computer to get the same values by default, homepage, bookmarks, etc...

    I found some help on older versions of Firefox, but I can't seem to find anything for the latest versions greater than 8. There must be a way to do this for imaging large scale.

    Have you created a defaults\profile in the folder of the program Firefox (C:\Program Files\Mozilla Firefox\)?

    All files in this folder will be moved into each newly created profile folder.

    To give the prefs a default, it is best to do this via a mozilla.cfg file.

    Use a mozilla.cfg file in the Firefox program folder to lock the prefs or specify default values.

    Place a local file - settings.js in the defaults\pref folder where you will also find the channel - prefs.js to specify using mozilla.cfg file.

    pref("general.config.filename", "mozilla.cfg");
    pref("general.config.obscure_value", 0); // use this to disable the byte-shift
    

    See:

    You can use these functions in mozilla.cfg:

    defaultPref();  // set new default value
    pref();         // set pref, but allow changes in current session
    lockPref();     // lock pref, disallow changes
    
  • relaxation led when the value is greater than

    Hey everybody! I have to do a project and im stuck because I'm a noobler with regard to labview. I'm using labview 6 and got to watch the pressure and temperature of a reactor in time. I need to create a system in which if a value is greater than it triggers an alarm (perhaps led can show it) or is less than a certain limit. I mean it should trigger an alarm when the temperature or pressure is beyond 100 and less than 10. And after that to generate a text document in which it is specified the time and date at which these values were exceeded. I also use randomly generated values. Can I get help please? I'm not manage it by myself)

    Line and force. as Norbert said.

    You won't get much sympathy on overloaded around here.  Three things occurred to me that I read your messages:

    1. You will be in trouble when you get a job if you think that you will be not always charged.
    2. If I help you, you'll probably end up working for me and I still have to do your homework.
    3. You'll be fine.  Engineers outsource their work all the time.

  • IMAQ_USB - 1074396024 (coverage Minimum value must be greater than zero)

    Hello

    I have problems to use a USB WebCam when I try to run an executable file in a PC that not have installed LabVIEW. The error code that is displayed is 1074396024 (coverage Minimum value must be greater than zero).

    When I run it on a PC that installed, LabVIEW everythings works great!

    Someone has an idea to help me? The sample program is attached.

    Thks

    Hey neat,

    To run your executable file in a free LabVIEW PC, you must install LAbVIEW Run-Time Engine and Vision Run-Time Engine.

    http://digital.NI.com/public.nsf/allkb/3EB8C8AFC1593B4A8625712E0002869B

    Engine performance vision application for permit.

    Best regards

    Abel Souza

    Engineering applications

    National Instruments Brazil

  • Read byte with a value up to 127 lire byte with an ASCII value greater than 7F (127 dec)

    Hello

    I have to read a byte with a value greater than 127, Labview turn 27.

    In help I saw that Labview provides a description of ASCII that pour values ranging up to ' 127.

    What do I need to do?

    LabVIEW 6.1

    Windows XP

    Hello

    I want to read a byte with a maximum value of 127, but Labiew reurn arround 27 value

    How do I do?

    Rigid wrote:

    Thanks for your help. I'm not changing lyke I understand (my English is poor quiet...)

    I have another program that communicate with the instrument. I know byte (6) must be greater than 18 (greater than 7F actually).

    But with Labview, I'm only 18.

    While it might be higher than 18 x, an I8 is signed, and therefore it cannot be greater than x7F - it has a range of-128 to 127. A U8 is not signed, and it's why he has a range from 0 to xFF. However, x 18 is the same if you treat as signed or not signed. I don't see how LabVIEW can read a wrong value on the serial port. Are you sure you're looking at the correct byte? Your code shows that you split the chain twice. Are you sure that you do this properly?

    Given that you use on Windows you can recheck the chain received using PortMon. Allows you to see what is actually received by the driver for the serial port on Windows.

    P.S. I actually meant the whole byte function.

  • Read/write file binary change greater than 128 bytes.

    Hi all, maybe a strange question, but I'm scratching my head on this one. There is undocumented behavior in the function of read/write binary file, where U8 a value greater than 128/0 x 80 get automatically converted to 0x3F value?

    I try to use LabVIEW to generate a binary file custom that we'll load in an EEPROM, so all data in the binary file is stored as values of U8. I have a "template" file, and eventually I'll take the logic implemented to replace the fields with the data from the true value. However, I am struck by the anomaly that when I just read the file in LabVIEW and then réécrirait, all the values 0x80 and more are truncated to 0x3F value. Has anyone seen this before, and is there a solution?

    I noticed writing the value 0 x 80 directly to one generates a binary file (such as a U8) 0 x 90, 0 x 70 being written in the binary file. It is also rather undesirable, as it adds additional bytes in the bytestream, and the bytes of EEPROM must be in exact locations.

    Join your data file.

    This program is to give the images below?  Are you sure that LabVIEW is to write the bytes differently?  I really doubt that.

  • Outlook 2007 backup file is greater than the source file. Why?

    My Outlook pst data source personal folders file using 2.4 GB.  The backup file (by using the backup tool) uses 5.4 GB.  Why the difference?  I back up all my data on a hard drive to FAT 32 format, which will not accept a file greater than 4 GB, so I'm not able to save Outlook backup file given its current size.

    Hello GaryCalgary,

    Thanks for visiting the site of the community of Microsoft Windows XP. The question you have posted is related to Outlook and would be better suited to the community of Office Discussion groups. Please visit the link below to find a community that will provide the support you want.
    Outlook General Questions Discussion Group

    Steven
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Keyboard failure - numbers greater than my letters on the kyboard quit working

    numbers greater than my letters on the kyboard stop working. nowwhen I pressed number it shows to whatever key I pressed last

    This sounds like a problem of keyboard input buffer . There are a number of issues pending with the keyboard buffer caused by software such as constant guard or GuardIDencryption. If you have installed the encryption of typing software, especially Comcastconstant guard, I can't recommend disabling/uninstalling software or specific assistance in support of the software publisher's web site.

  • How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    You could import the movie into Windows Movie Maker, use the 'split' option, split the video to 2 or more smaller movie files, then burn each smaller movie file to separate DVDs.

    This would be my method. There may be a better way.

    For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • 'Tools of sea for Windows' error: 'length' argument must be greater than or equal to zero. System. rope mi (System. sting. int32 int32).

    Original title: HOW to FIX THIS? 'length' argument must be greater than or equal to zero. System. Middle string (System. sting int32 int32.)

    Hi everyone in the Microsoft community,

    I am a novice at this stuff to pc, so excuse me if I ask a stupid question!

    I try to use Seatoolsforwindows, but during the research phase, this message comes on the screen...

    'length' argument must be greater than or equal to zero. System. Middle string (System. sting int32 int32.)

    I uninstalled and reinstalled Seatools, but I get the same results.
    I sought answers from Google and could not find a suggestion to install
    Microsoft Visual C ++ 2005 and Microsoft Visual C ++ 2008. I have 5 versions of this software installed.

    Details of the system
    Card mother Gigabyte X48T DQ6
    Intel Q6600 CPU
    8 GB of DDR3 RAM Corsair
    Card MSI GTX680 tiun graphic Frozr
    PSU Corsair 620W
    Operating system Windows 7 Pro
    Hard Seagate and Samsung drives

    I would appreciate if someone can help me on this one.

    Thank you

    Tim B

    Instead of using the version of win, try the bootable version

Maybe you are looking for

  • Bar does not address of Firefox

    I enter a URL in the address bar, press ENTER, the browser starts to act like he is going to go to the address of the request and then stops. The browser will not anywhere, go except the web Google pages, if I use the google search on the home page.

  • Satellite 2450 - the display hinges loose

    The screen on my Satellite 2450 lost its resistance on the hinges, its either fully open or fully closed and will not be held in position. The speakers or the other side of the hinge have lifted a bit, I can get in and repair the damage?

  • my bluetooth does not work on my hp probook 4320 s

    my bluetooth does not work on my hp probook 4320 s, no devices can be detected, files cannot be sent or received, even my mobile phone cannot detect the computer

  • HP ENVY 7640: Wireless radio does not work

    I just bought this printer and it didn t find the network. I printed a report that said now the wireless radio is not working, you need HP support. Something you can do about it or how I deliever back to where I bought it?

  • QuickVPN connected, but I can't do anything on the LAN ping

    Hi all I try to use QuickVPN to connect to my corporate network. Yesterday I was to the point where QuickVPN actually connected and I could connect to the router from inside IP. But I can't see, or ping all computers on the LAN to company. Manual of