Call a procedure that returns an array of the results of dotnet

Hi I have a function in the database (see below), I am creating a Web page and you want to call the function and get the results, how can I do this in dotnet using the ODP.net. does anyone have a code please... I called procedures in the database that return of refCursors but not tables.


Type rec_user is record (call varchar2 (200),)
Identification number);

Type tab_user is table of the rec_user;

function populate_user (piusername in varchar2) return tab_user;

------------------------------
Concerning
Ash

Hello

Registration table is a PLSQL type and cannot be called from OIC (this is what ODP.NET is written in). If you change the procedure to return the table or Varray of the object instead, you could do that with the support of the UDT available in ODP 11106.21 and higher.

There is an example in this thread that you may find useful:
By the way the table of the UDT or Collection, as IN to the OracleDbType.InputOutput HELP

It will be useful,
Greg

Tags: Database

Similar Questions

  • Calling a procedure that returns a cursor in a procedure

    Hello
    I have two stored procedures. They both return a cursor as output variables. However, I have another stored procedure that calls these procedures and return their results once again an output variable. I know that sounds strange to want to do something like this, but how can I do this?

    Mikhail says:

    My first procedure returns a cursor. But the cursor is opened on one condition. Like, if PARAM1 = 1 THEN OPEN cursor_1 to SELECT... OTHERWISE, OPEN CURSOR_1 TO SELECT... And the second slider has the same structure. The thing is in the two procedures if I declare that a single CURSOR_1 IN OUT parameter that the procedure will not work. So in both entities, I have two variables IN OUT SYS_REFCURSOR: c1 and c2. Then, in the third procedure I first call the first procedure, then the second. How can I write my third procedure in order to obtain the result two procedures United?

    Why the appellant (3rd procedure) need to have 2 ref Cursor? How will the appellant to "unite" the sliders?

    The actual data, a power of work must be done inside sliders. Not in PL/SQL or other languages. The SQL language is a very powerful and flexible language.

    So if the SQL 2 data sets (or more) must be "United", then you should not use the 3rd procedure and PL/SQL code to do. Should use you 2 sliders.

    You should watch this by using SQL only. The 2 sets of data can be merged, joined, union'ed. You can determine the intersection. You can determine the difference (with a negative sign). It can be rotated. It can be aggregated. It can be cube' ed. Etc.

    This SQL will then be used as a single slider and a unique reference cursor handle will be used to consume the output of the cursor.

    The basic rule to develop Oracle applications is simple. Optimize SQL. Minimize the PL/SQL.

    Use the SQL language to the data of the crisis. No PL/SQL.

  • Call a procedure that returns a refcursor, use it in an another proc sql?

    I have a procedure that returns a refcursor; How can I include this refcursor in a sql statement that is inside another procedure, or view etc.?

    This is the kind of foolery, I tried so far (myproc1 returns a ref cursor):

    create or replace procedure myproc2
    (
    slider ref RC
    )
    AS
    RC1 of ref cursor;
    Start
    EXECUTE myproc1 (rc1).
    Open rc for
    Select rc1.* in the rc1;
    end myproc2;

    If you want to use the result set in an SQL Ref Cursor won't be of any help. Can be read all nested Table Type. You can declare an object type and store your result in them and use them in SQL.

    Thank you
    Knani.

  • Create the object type with a member function that returns an array of the object type

    Hello

    Is possible to compile code like this in Oracle SQL?

    CREATE OR REPLACE TYPE type_obj IS OBJECT (
      MEMBER FUNCTION f RETURN table_obj
    );
    
    CREATE OR REPLACE TYPE table_obj AS TABLE OF type_obj;
    
    

    In Java, it would be possible.

    Thanks in advance

    Circular dependencies must be resolved by means of REF pointers and incomplete type definition.

    See: Oracle objects management

    CREATE or REPLACE TYPE type_obj;

    /

    CREATE or REPLACE TYPE table_obj AS TABLE OF ref type_obj;

    /

    CREATE or REPLACE TYPE type_obj () IS OBJECT

    fake number

    Table_obj RETURN of the FUNCTION MEMBER f

    );

    /

    Now, it must implement the body of type.

    Note that a table of the REFs is not very useful in the plain of PL/SQL, the underlying data must be stored in a nested table if you want to use.

  • Call a package.procedure that accepts an array type.

    I get the error message "Error (45.20): PLS-00330: incorrect use of the name of type or subtype" when I run the SP procedure when it calls the d.is_date procedure that accepts an array as the second parameter.

    Here's the short code for package.procedures that contain the "is_date.

    I tried several things and can't seem to get the SP to compile.
    Thank you.



    create or replace
    PROCEDURE SP ACE

    valid_out boolean;
    date of date_out;
    date_fmt_out varchar2 (30);

    type of Mask_Tabtype is
    table of varchar2 (30)
    index of directory;

    FMT Mask_Tabtype;

    BEGIN
    FMT (1): = 'fxDD-MON-RR ';
    FMT (2): = 'fxDD-MON-YYYY ';
    FMT (3): = 'fxDD-LUN;
    FMT (4): = ' fxMM/DD ";
    FMT (5): = ' fxMM/RRRR ";

    d.Is_Date ('test', Mask_Tabtype, Valid_out, Date_out, Date_Fmt_out);

    END SP;


    create or replace package d as

    type of Mask_Tabtype is
    table of varchar2 (30)
    index of directory;

    FMT Mask_Tabtype;

    Procedure Is_Date (Value_in in varchar2,
    Tab in Mask_Tabtype,
    Valid_out Boolean
    Date_out date,
    Date_Fmt_out out varchar2);
    end of;



    create or replace package body d as
    Whole Fmt_Count;
    Date of Date_Val: = null;
    Date_Fmt varchar2 (30): = ' fxMM/JJ/AAAA ";

    Procedure Is_Date (value_in in varchar2, Mask_Tabtype tab,
    Valid_out Boolean, Date_out date, Date_Fmt_Out out varchar2)
    is

    Start
    / * Logic here removed to make more small
    .........
    */
    End Is_date;
    End of;

    Ah, it's because you have tab_masktype stated in the package and in the calling code.

    Change your PS procedure declaration to be:

    Fmts d.Mask_Tabtype;
    

    and there is no need to declare Mast_tabtype in this procedure.

  • Calling an Oracle stored procedure that returns a REF cursor

    Hi guys,.

    I'm calling an Oracle stored procedure that returns a REF CURSOR. Here is the piece of code that I'm working on:

    procedure TC307_MAIN (p_program varchar2, varchar2, varchar2, result_set OUT eng_cur p_engchgno p_project) as
    Start
    IF (p_program = 'Navybased' and p_project = 'PROTECTOR-BUILD') THEN
    result_set: = comments. Tc307_Eng_Chg_Rpt.TC307_RNZN (p_engchgno, result_set = >);
    END IF;
    end TC307_MAIN;

    procedure TC307_RNZN (p_engchgno varchar2, result_set IN OUT eng_cur) as
    Start
    end TC307_RNZN;

    PL/SQL code behind TC307_RNZN is big enough, that's why I've not stuck here. Basically, the second stored procedure executes a PLSQL statement and returns a result set. I need to return the result_set in the main proceedings based on nested else statement which I am still trying to build. I get a compilation... error can someone guide me with the correct method to call the second stored procedure and returning in the main proceedings.

    Thank you very much.

    Rohan,

    Try this

    procedure TC307_MAIN(p_program  varchar2,
                           p_project  varchar2,
                           p_engchgno varchar2,
                           result_set OUT eng_cur) as
      begin
           IF (p_program = 'RNZN' and p_project = 'PROTECTOR-BUILD') THEN
                  -- This is a procedure not a function
                         guest.Tc307_Eng_Chg_Rpt.TC307_RNZN(p_engchgno, result_set); --UR compilation error on this line*
          END IF;
      end TC307_MAIN;
    

    SS
    http://DB-Oracl.blogspot.com

  • How to execute a stored procedure that returns a cursor?

    How to execute a stored procedure that returns a cursor?

    Follow the code:

    CREATE OR REPLACE PROCEDURE stp_cashin_grupo
    (p_func in VARCHAR
    p_cod_grup in full
    p_des_grup in VARCHAR
    p_logi in VARCHAR
    p_curs_rset ON infoc.pck_cashin_grupo.curs_rset
    )
    IS
    BEGIN

    If p_func = "1" then
    OPEN FOR P_curs_rset
    Select
    cod_grup
    des_grup
    dat_manu_grup
    des_logi_manu
    of infoc.tbl_cashin_grupo
    order of des_grup;
    end if;
    END stp_cashin_grupo;


    and packaging:

    CREATE or REPLACE PACKAGE pck_cashin_grupo
    AS
    TYPE curs_rset IS REF CURSOR;
    END pck_cashin_grupo;

    My question is how to execute in sql plus?
    Stp_cashin_grupo EXEC ('1', 0, ", '465990', my doubt is how to move the cursor as return)


    Thank you

    It is described in the manual

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14357/CH5.htm#sthref1122

  • How to call a function that returns a SYS_REFCURSOR?

    Here's the situation.
    If I use ODP. NET to get a REF_CURSOR of a procedure in a package that it works without a hitch.

    If I use ODP .NET to run an Oracle function that returns a REF CURSOR, all sorts of things fool you.
    I use .NET 3.5 and ODP .NET version 2.112.1.2 (11 G). My Oracle database is 9.2.0.7.0

    There is this function returns a REF CURSOR.
    The code looks something like this.
    CREATE OR REPLACE FUNCTION SENDMEAREFCURSOR RETURN SYS_REFCURSOR IS
      X_REF genPkg.genericcursor;
    BEGIN
      OPEN X_REF for
        SELECT customer_id, name FROM CUSTOMERS;
      Return X_REF;
    END;
    .NET code looks like this. It's after a few adjustments.
            private static OracleDataReader FireMyFunc(OracleConnection oc)
            {
                try
                {
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection = oc;
                    //cmd.CommandText = "SELECT sendmearefcursor FROM DUAL";
                    //cmd.CommandType = System.Data.CommandType.Text;
                    cmd.CommandText = "sendmearefcursor";
                    cmd.CommandType = CommandType.StoredProcedure;
                    OracleParameter prm = cmd.CreateParameter();
                    prm.OracleDbType = OracleDbType.RefCursor;
                    prm.ParameterName = "returncurse";
                    prm.Direction = ParameterDirection.ReturnValue;
                    cmd.Parameters.Add(prm);
                    cmd.ExecuteNonQuery();
                    return (OracleDataReader) prm.Value; //Throws an UnableToCast exception.
                }
                catch (System.Exception ex)
                {
                   Console.WriteLine(String.Format("FireMyFunc: {0}",ex.ToString()));
                    throw;
                }
            }
    What should I do to get the refCursor?

    Hello

    You can use the GetDataReader of the OracleRefCursor object to return the datareader object.

    OracleRefCursor rc is prm (OracleRefCursor). Value;
    return of rc. GetDataReader();

    HTH
    Jenny

  • Hi friends I want to know how to call a procedure that has values arrary as parameter?

    I have a procedure as shown below, and I am using oracle 11g.

    create or replace procedure procedureName (v_hospital_id in NUMBER,

    v_process_id VARR_VARRY,

    v_cnt OUT NUMBER);

    Now, how to call this procedure from PLSQL. If v_process_id values ('abc123', 'xyz234', 'sfs234')

    Please present the definition of VARR_VARRY

    If it's a simple table of varchar2.

    declare

    v_cnt NUMBER;

    Start

    procedureName (1, VARR_VARRY('abc123','xyz234','sfs234'), v_cnt);

    end;

  • 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

  • Interactive report that returns 0 rows on the initial screen of forcing

    How can I get the initial display of my interactive to have 0 rows (and quickly) reports on the initial display, so that the user can determine the lines they want without having to wait for the report view without much in the way of the filters?

    My reports many lines of 50-100 k with several joins of tables: so they are slow and the initial default result set is not useful for them, until they start of construction interactive filters themselves.

    I tried to add a default I / filter R which is never true, return 0 rows, but if I have good corrrectly, APEX will execute the sql 1, returning the default #of ranks backward, THEN that wraps like a subselect and applies to the i / R filters. So, I still have to wait for the report of 'run' before its filtered to 0 rows...

    I'm experimenting also with a flag of pxx_firsttime, intiall value, and according to my report SQL NVL(:Pxx_FIRSTTIME,'Y') = n and (rest of joins of tables)...
    the problem I have with this is, how can I get this option the value N as the user begins to use the interactive report filters, etc., which seem NOT to resubmit the page?

    Thank you

    Hello

    I tried to add a default I / filter R which is never true, return 0 rows, but if I have good corrrectly, APEX will execute the sql 1, returning back by default #of lines, THEN that wraps like a subselect and applies the > I / R filters. So, I still have to wait for the report of 'run' before its filtered to 0 rows...

    Yes, you are right.

    I assume that you already have using the paging Type as line from X to Y.

    the problem I have with this is, how can I get this option the value N as the user begins to use the interactive report filters, etc., which seem NOT to resubmit the page?

    Whenever the user do something with 'Actions', APEX IR will get updated. Thus, to create a dynamic Action that will be triggered before the refreshment of your IR, update the session state from P1_FIRSTTIME_FLAG to "n".

    Kind regards
    Hari

  • Service that returns all documents at the Complutense University of MADRID

    Do we not have a service that returns the revision Lee of all documents (native document and documents of data file type) at the Complutense University of MADRID?

    Kind regards
    Pratap

    Hi Pratap,

    GET_SEARCH_RESULTS does not return the latest revisions? You can restrict to only native of Documents and data files if you want in your query. You will be limited by the MaxResults defined in the file config.cfg to the content server, I think.

    -jason

  • dbAdapter fails during the call to procedure package oracle object type in the parameter out

    JDeveloper 1.1.1.6

    Oracle 11g

    Existing package procedure is defined with the table of objects in input parameters and.

    Package myPackage

    procedure processRecon (numero_projet VARCHAR2,

    INST_ID select NUMBER,

    recon_type VARCHAR2,

    gis_design_stock GMPVT. GMPVT_GIS_DESIGN_STOCK_T,

    stock_uop GMPVT. GMPVT_STOCK_CODES_T,

    x_status OUT VARCHAR2,

    x_escalation OUT VARCHAR2,

    x_recon_error ON GMPVT. GMPVT_GIS_RECON_ERR_T) IS

    GMPVT. GMPVT_GIS_RECON_ERR_T is an array of GMPVT objects. GMPVT_GIS_RECON_ERR, who has 12 fields including the new I added it.

    I have added a new field to the GMPVT object. GMPVT_GIS_DESIGN_STOCK, where GMPVT. GMPVT_GIS_DESIGN_STOCK_T is a table of GMPVT. GMPVT_GIS_DESIGN_STOCK, no problems encountered during the test.

    Next, I added a new field for the object of type GMPVT. GMPVT_GIS_RECON_ERR, the following error below occurs when the DBAdapter is called

    < Summary > Exception occurred when the link was invoked. Exception occurred during invocation of the JCA binding: "JCA binding run operation 'processStockRecon' failed due to the reference: Interaction processing error." Error in the processing of applications from running. GMP_SOA_RECON_PKG. Interaction of the PROCESSRECON API. An error occurred during the processing of the interaction to invoke APPS. GMP_SOA_RECON_PKG. PROCESSRECON API. Cause: java.lang.ArrayIndexOutOfBoundsException: 12 check to make sure that the XML file containing the data of the parameter matches the parameter definition in the XSD. This exception is considered non reproducible, probably due to an error of modeling. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution. < / Summary >

    I confirmed that the XSD for the stored procedure has in fact change, which has been generated by JDeveloper as I refreshed the database adapter.

    The statement "Cause: java.lang.ArrayIndexOutOfBoundsException: 12" I can't that assume somehow SOA has 12 parameters but the 12 setting was not saved.

    Any thoughts on what I might be missing. I can provide more information if necessary.

    Hello

    This problem has been resolved. Not deployed SOA composite and then deployed to the server of the SOA. For some reason, SOA has been either you see does not changes in the file XSD (cached?) or the XSD was not get updated.

    Thank you

  • Function that returns null instead of the expected value

    I use SQL Developer version 3.2.20.09. When I run a certain custom stand-alone function, I get a result null instead of the numeric result. Other people in my workgroup to get the correct result. When I run the function by using SQL Plus, I get the expected result. Is it possible there are a few settings in SQL Developer that is causing this behavior?

    Any ideas appreciated.

    -Debi

    Yes, but without seeing your code, it is difficult to know for sure. The first thing I would check is your NLS settings in tools > Preferences.

  • SQL code - call a column that has a reserved as the name keyword

    Hi all

    As seen in the title, one of the tables in the database that I am trying to extract information from one of its columns is a reserved keyword.

    I am trying to run SQL on Oracle SQL Developer test code.

    The simple code, I'm running is:

    Select number

    of specific_table

    As a result:

    ORA-01747: invalid column, table.column, or user.table.column specification

    01747 00000 - "invalid user.table.column, table.column or column specification.

    Is there some sort of way to get around this?
    Any help would be greatly appreciated.

    Thank you!

    Yes, use the names in quotes:

    SQL > create table tbl (number)
    2.
    create the table tbl (number, number)
    *
    ERROR on line 1:
    ORA-00904: invalid identifier

    SQL > create table tbl ("number")
    2.

    Table created.

    SQL > insert
    2 tbl
    3 values (1)
    4.

    1 line of creation.

    SQL > select number
    2 tbl
    3.
    Select number
    *
    ERROR on line 1:
    ORA-00936: lack of expression

    SQL > select "number".
    2 tbl
    3.

    number
    ----------
    1

    SQL >

    SY.

    PS you need to find the EXACT (creating) the spelling of the column name. Use the DESC or select XXX_TAB_COLUMNS.

Maybe you are looking for