Function, cursor item as parameter in oracle 9i

Hello,
i have a block that make treatment for every cursor iteration
in fact, i wanna make a function that take as parameter the cursor iteration
so there is two possibilitities , i call this function when looping under the cursor,
or when i has a specified row on the table Contrat, let's say a result of select * from contrat where ...
here is the cursor definition :
CURSOR contrat_cursor (per_param IN NUMBER)
IS
SELECT *
FROM CONTRAT
WHERE PER_ID = per_param;
any one know how make this
Regards
Elyes

in fact i have a loop over a cursor :
LOOP
tmp_var:=0;
FETCH contrat_cursor INTO contrat_rec;
          EXIT WHEN contrat_cursor%NOTFOUND;
treatment1 -- i want to put all this trt1 in a function , and the function , since it depend on contrat_rec, will have a parameter
end loop;
in other context i need this function to make some trt in one row of the table contrat
so i can get this row with select * from contrat where ...
my question, is this ok when i give contrat_cursor%ROWTYPE as parameter to the function
and in the second context, when i get back i row from table contrat , how can i give this row as paramer , in contrat_cursor%ROWTYPE form
i wish it was clear
Regards
Elyes

Similar Messages

  • How to set Oracle function as a PreparedStatement parameter?

    Hi all,
    I was wondering if it is possible to use Oracle function as a PreparedStatement parameter? For example:
    PreparedStatement pstmt = new PreparedStatement("update table set date=? where ...");
    pstmt.set???(1, sysdate);I can put the function in the sql directly of course, but the parameter is depending on some condition. Any idea is greatly appreciated.
    Joey

    First, sysdate isn't a function, it's really a pseudo-value.
    Second, it doesn't exist on the Java side, therefore it can't be bound via a set statement.
    The correct and standard way is to put it in the SQL; if the use of sysdate is conditional, you can:
    1) embed the conditionality in the SQL, e.g.:
    PreparedStatement pstmt = new PreparedStatement("update table set date= decode( ?, 0, ?, 1, sysdate, sysdate) where ...");2) for more complex conditionality, define a custom function and embed that in your SQL
    3) do it on the Java side and use more than one preparedstatement

  • Cursor like input parameter in function

    Hi, All !
    I have a question. I want use cursor like input parameter in function. How can I do this? Please give my an example.

    in fact i have a loop over a cursor :
    LOOP
    tmp_var:=0;
    FETCH contrat_cursor INTO contrat_rec;
              EXIT WHEN contrat_cursor%NOTFOUND;
    treatment1 -- i want to put all this trt1 in a function , and the function , since it depend on contrat_rec, will have a parameter
    end loop;
    in other context i need this function to make some trt in one row of the table contrat
    so i can get this row with select * from contrat where ...
    my question, is this ok when i give contrat_cursor%ROWTYPE as parameter to the function
    and in the second context, when i get back i row from table contrat , how can i give this row as paramer , in contrat_cursor%ROWTYPE form
    i wish it was clear
    Regards
    Elyes

  • How to use select-options in the function module of import parameter ?

    Hi ...
       I have created a BAPI and tested in SWO1 tcode , by giving the single value for an company code ( BUKRS ) , it executed properly .
    Same thing is working after implementing in a program .
    so now it is working for fetching a single company code details .
    My requirement is : I want to use select-options in program as well as in function module IN IMPORT PARAMETER.
    Program :
    REPORT  ZTEST.
    TABLES : T001 , ZBAPI_STR .
    TYPES : BEGIN OF TY_ITEM  .
              INCLUDE STRUCTURE ZBAPI_STR .
    TYPES : END OF TY_ITEM .
    DATA :WA_ITEM TYPE TY_ITEM ,
          ITEM LIKE STANDARD TABLE OF WA_ITEM INITIAL SIZE 0 .
    PARAMETER : BUKRS TYPE ZBAPI_STR-BUKRS.
    call function 'ZBAPI_FMT001'
      exporting
        bukrs         =  BUKRS
    IMPORTING
      RETURN        =
      tables
        itemtab       = ITEM
    IF ITEM IS NOT INITIAL .
      LOOP AT ITEM INTO WA_ITEM .
        WRITE : / WA_ITEM-BUKRS , WA_ITEM-BUTXT , WA_ITEM-ORT01 , WA_ITEM-LAND1 .
      ENDLOOP.
    ENDIF.
    FUNCTION MODULE :
    FUNCTION ZBAPI_FMT001.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(BUKRS) TYPE  EFG_TAB_RANGES
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRET2
    *"  TABLES
    *"      ITEMTAB STRUCTURE  ZBAPI_STR
    SELECT BUKRS BUTXT ORT01 LAND1 FROM T001 INTO TABLE ITEMTAB WHERE BUKRS = BUKRS .
    ENDFUNCTION.
    Regards
    Deepa.

    I have given a similiar example which i did
    Declare a
    Table type:Z_TT_PONUM             
    Short text  :  Select options  PO Number
    in SE11 tcode with row type eg: Z_ST_PONUM
    create a structure (this will be the row type)
    Structure          Z_ST_PONUM            
    Short text         Select Options Field PO number
    Compenent  Compent type
    SIGN       BAPISIGN      Inclusion/exclusion criterion SIGN for range tables
    OPTION       BAPIOPTION      Selection operator OPTION for range tables
    LOW       EBELN                      Purchasing Document Number
    HIGH       EBELN                      Purchasing Document Number
    In the function module import
    give as
    I_PO_NUM     TYPE     Z_TT_PONUM     opt  pass value Select options  PO Number
    Hope this is exactly what you want to know.
    So you create a structure simliar to mine but the low an high whould be your component
    then a table type  and then include that in the BAPI.
    Then pass your select-option value to this BAPI when you call this BAPI in the program

  • How to create a function with ref_cursor as parameter in OWB 10.1

    Hi,
    Can any one help me how to create a function with ref_cursor as parameter in OWB 10.1.?
    Its urgent. Please help me.
    Thanks,
    Siv

    Hi David,
    Thanks for your reply.
    Before going for this function, I need to create a package in transformation node in owb module.
    My package is as follows,
    Create or replace package 123
    type xxx is RECORD ( parameters);
    type yyy is RECORD (parameters);
    type aaa is table of yyy;
    type bbb is REF CURSOR return xxx;
    type ccc is record (parameters);
    type ddd is ref cursor return eee;
    END;
    How can I create the above kind of package manually in OWB 10.1 (Should not to import the package)
    Please help me its urgent.
    Thanks,
    Siv

  • Using ref cursor in after parameter form in reports

    hi everyone,
    I have problem in usage of ref cursor in after parameter form. My actual requirement is I have user parameter :p_minval, :p_maxval. The values into these user parameters will be coming dynamically using sql_statement as shown below
    select min(empid),max(empid) into :p_minval, :p_maxval from emp where empid in (:p_emp);
    I will be writing this query in the after parameter form
    :p_emp is a lexical parameter as per me but the after parameter form is taking it as a bind variable. so I decided to define a ref cursor and then use it for retrieve. But when I use ref cursor it is returning pl/sql error 591 saying that this is not supported by client side can anyone help me plz..
    The following is the code i tried to use in after parameter form
    function afterPform return boolean is
    type rc is ref cursor;
    l_rc rc;
    sqlstmt varchar2(512);
    begin
    sqlstmt:='select min(empid),max(empid) from emp where empid in ('||:p_emp||')';
    open l_rc for
    select max(empid) from emp where empid in ('||:p_emp||')';
    fetch l_rc into :p_maxval;
    close l_rc;
    return(true);
    end;
    thanks & regards
    venkat

    I ran into the same problem. any body knows why?

  • Passing Ref Cursor as IN parameter

    I have a situation where I have to send whole table into the stored procedure, I read from the oracle new feature for .Net documentation, It is possible to pass an ref cursor as IN parameter to an stored procedure. Please help me in this, it is urgent!
    I am using Visual Studio.Net 2003, ODP.Net.

    Array binding is the best method for large inserts from .NET.
    The problem with the associative array is:
    -you must write a PL/SQL procedure to actually do the inserts.
    -while this will get the data to the PL/SQL engine on the server in a block, it still must cross the into the SQL engine one row at at time.
    -Array binding is simpler (you use a normal insert).
    -There's a built-in knob to control the batch size.
    -The array of row data is copied all the way into the SQL engine together, so it's faster.
    Remember, array binding is how the SQL*Loader's conventional-path inserts work.
    According to Tom Kyte "you can achive 100's of rows per second into heavily indexed tables that are concurrently being read and updated by other processes."
    David

  • Error while adding items to cart using oracle.apps.ibe.shoppingcart.list.ShopList.saveQuoteFromListLines API

    Hello,
    I am getting the below error message when I try to add line items to cart using oracle.apps.ibe.shoppingcart.list.ShopList.saveQuoteFromListLines API.
    ORA-01403: no data found in Package IBE_Shop_List_PVT Procedure Save_Quote_From_List_Items
    This is the underlying procedure/package getting called:  IBE_Shop_List_Wrapper_PVT.Save_Quote_From_List_Items
    Please help me in resolving this issue.
    Thanks in advance!

    L S P.. wrote:
    Hi,
    Actually that notes says about invalid objects in ASO and IBE objects.
    But i couldn't found any invalid objects. Also i was cleared cache using functional administrator also.
    But still am getting this error.
    Please help on this.. It is on critical.Please log a SR if the doc did not help.
    Thanks,
    Hussein

  • How to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B

    Hi Friends,
    How to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B.
    External Trading Partner is sending the EDI 856 via AS2 URL to our Oracle B2B Server.
    In the inbound 856 agreement, we have checked the option of Funtional Ack and also Functiona Ack handled by B2B is yes.
    We have the outbound agreement which is sending that Functional ack 997 (auto generated by oracle b2b) and we have specified the Outbound AS2 channel of the Partner.
    997 doc is being sent to external partner using AS2 channel, but the filename is generating as '40101'.
    Please can you let me know how to set the AS2 fileName for outbound Functional Ack 997 auto generated by Oracle B2B.
    Appreciate your valuable answers!!
    Thanks,
    Amirineni

    Amirineni,
    AFAIK, there is no option to set the file name when the 997 is generated automatically by B2B.
    Alternatively, if this is a must requirement, you can generate the FA from backend and  send to B2B with MSG_TYPE =9. In this case, you can set the header with filename (How to set the actionname property in B2B 11g)

  • How to use oracle functions in Crystal Reports XI using Oracle Server

    Hi all,
    Is it possible  to use oracle functions in Crystal Reports XI using Oracle Server as Data Source.
    If i try to use a procedure,i am getting error with message "Invalid Arguement Provided".
    Functions are not visible objects like tables,views and stored procedures.
    The  jdbs driver i m using is oracle.jdbc.driver.OracleDriver.

    I think it is not possible to add functions in crystal directly for any database. You need to use those functions in a stored procedure and add that storedprocedure as a datasource.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233353335333833323333%7D.do]
    regards,
    Raghavendra

  • Stored procedure with cursor as out parameter

    Can any one help me by showing how to write a procedure with cursor as out parameter and caputuring it in java using jdbc.
    Thanks in advance,
    shravan bharadwaj

    I know that in the SQLJ distribution (which is also downloadable) there is an example in the demo directory called RefCursDemo that shows the SQL code and how to call it - albeit from SQLJ and not JDBC. There may also be a demo in the JDBC distribution, though I am not sure about that.

  • Bind variable with search parameter in Oracle BI Publisher 10

    Search list for a search parameter in Oracle BI EE works fine when the query doesn't contain a bind variable (parameter identifier). But when a bind variable is introduced in the constraint of search list query, it keeps on searching endlessly. For example,
    -- this doesn't work
    select col1
    from table
    where table.col2 = :I_param_bind_var
    -- this works
    select col1
    from table
    where table.col2 = 'xyz'
    Using such bind variable in the list of values for menu parameters works fine. Is it an issue regarding publisher or am I missing something?
    Edited by: 933296 on Aug 21, 2012 1:38 AM

    <?param@begin:Show_Location;'Yes';'string';'Yes,No'?>
    it will give the Parameter Show_Loactaion with drop down Yes and No.
    and to display <?$Show_Location?>
    <?param@begin:dept;'PAY'?>
    <?$dept?>

  • SOCO function "Complete Item" doesn't work

    Helo.
    Please help to solve a problem.
    We have SRM 5.5
    We want to remove positions from SOCO through function "Complete Item".
    But at logon under the Ukrainian language function doesn't work. At logon under English language function in SOCO works.
    How can it be? And why?

    Hi,
    either you need to install the Ukrainian language completely (including supplementation) or if you plan to use the translation workbench for mass translation, you need to translate the texts included in the application you use.
    Please note: If you plan to use Translation Workbench (SE63) for mass translation, supplementation in that system should be avoided (see e.g. SAP Note 353852) !
    Best regards,
    Nils Buerckel

  • REF Cursor as Job Parameter

    Hi,
    is it possible to use a REF cursor as a parameter for a job? I need jobs created with DBMS_SCHEDULER.create_job to process data which has always the same format but comes from different sources. The job must be generic and thus should not know where the data comes from. The job calls a PL/SQL procdure which takes the REF cursor as a parameter.
    Regards,
    Pat
    Edited by: Gwydion on Jun 16, 2010 7:13 AM

    Gwydion wrote:
    I tried a different way: Instead of a ref cursor, I tried to pass a PL/SQL table containing the data that the job should process. Bad idea in general as this is not very scalable. A PL/SQL "+table+" is nothing table-like at all. The correct term is array or collection. This structure is primitive in that it cannot be indexed or structured like a SQL table. It also resides in "expensive" memory (the PGA/private memory of a server process) - unlike a SQL table data that will reside in the SGA buffer cache when used. The db buffer cache is shared memory - usable by all processes and thus "inexpensive" memory in comparison.
    So passing and processing any largish data structure that way (via PGA memory) is inherently an unscalable approach. Also, this data set needs to persist until the job process kicks off - thus it needs to be stored somewhere. Why store this data again when it is based on table and row table that already exist in the database? Why duplicate the data?
    You also need to consider data concurrency and integrity. By the time that job/scheduler background process kicks off and receives this data set structure to use for processing... the row data that this set was based on may have changed.. or may not even exist anymore.
    For example, let's say that the data set contains a list of invoice numbers that need to be processed. Some of those invoices may have been canceled in the meantime. Or deleted from the system. Whatever invoice numbers this background server process now needs to deal with, can now be invalid.
    You therefore need to carefully consider exactly what issues and requirements you're trying to address with this approach you are attempting. There are numerous problems areas that it needs to deal with.
    Which begs the question - why are you considering this approach? What problem are you trying to address? Why not simply pass the parameters to the job it needs to use to call the procedure that creates the ref cursor? This is a much simpler and elegant solution than to pass the actual data returned by the ref cursor to the job.

  • Lightroom 5.3: cannot resize a pict in export function with "bord etroit" parameter.

    After install Lightroom 5.3 we cannot resized a pict in export function with "bord etroit" parameter. It's good with "bord large"!...
    Regards
    Jacques

    DanCarr wrote:
    I'm sure this was working in the previous version......
    Yep - new bug in Lr5.3 (presumably will be fixed in Lr5.4).
    More info here:
    http://feedback.photoshop.com/photoshop_family/topics/publish_service_harddisk_ignores_ima ge_sizing_resize_to_fit_short_edge_setting_when_source_image_is_a_dng_on_lightroom

Maybe you are looking for