Storing the values from a procedure - help required

Hi All,
I am having a package which consists of two procedures.
Both the procedures need to calculate 6 averages of some of my fields based on unique number.
(These two procedures process different unique numbers).
Now, as same code is implemented in the two procedures for calculation,
I want to move the logic into another procedure/function, with IN parameter as the unique number.
Now how can I get these 6 values from the procedure.
If I use OUT parameters, how can I get the values inside the procedure.
Please suggest me a solution.
Thanks in advance.
Regards
Raghunadh

Example of pipelined function...
SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
  2  ( col1   VARCHAR2(10),
  3    col2   VARCHAR2(10)
  4  )
  5  /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
  2  /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
  2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
  3    v_obj myrec := myrec(NULL,NULL);
  4  BEGIN
  5    LOOP
  6      EXIT WHEN v_str IS NULL;
  7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
  8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
  9      IF INSTR(v_str,',')>0 THEN
10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
12      ELSE
13        v_obj.col2 := v_str;
14        v_str := NULL;
15      END IF;
16      PIPE ROW (v_obj);
17    END LOOP;
18    RETURN;
19  END;
20  /
Function created.
SQL>
SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
Table created.
SQL>
SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
3 rows created.
SQL>
SQL> select * from mytab;
COL1       COL2
1          2
2          3
4          5Although I'm not sure you necessarily need to do it this way. Could you show us the code you are using and more details of what you are trying to do?

Similar Messages

  • Unable to update the values from store procedure

    hi ,
    I have simple table with 3 columns. id, name , sal. am updating the salary based on names. 
    alter PROCEDURE p1(@names varchar(100))
    AS
    BEGIN
    declare @empData varchar(200)
    set @empData= '''' + replace(@names,',',''',''')+''''
    print @empData
    update tmp set sal =10 where name in ( @empData )
    END
    GO
    if I execute same query (update tmp set sal =10 where name in ( @empData )) outside with printed @empData data it is working fine.
    why the same is not working with SP ?
    any ideas...

    You need to split the list into a temporary table or table valued variable:
    alter PROCEDURE p1(@names varchar(100))
    AS
    BEGIN
    declare @empTable table ([name] varchar(100));
    declare @p int = 1;
    declare @len int = len(@names);
    declare @nextP int = charindex(',', @name, @p) ;
    set @nextP = case when @nextP = 0 then @len else @nextP end;
    while @p < @len
    begin
    insert into @empTable
    values (substring(@names, @p, @nextP-1));
    set @p = @nextP + 1;
    Set @nextP int = charindex(',', @name, @p) ;
    set @nextP = case when @nextP = 0 then @len else @nextP
    end
    update tmp
    set sal =10
    where name in (Select [name] from @empTable );
    END
    GO
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • How to extract values from pricing procedure for conditions in CRM Billing?

    I have a number of conditions in the pricing procedure in CRM Billing that I would like to extract to SAP BW. How can this be done?
    Is there a standard extractor for CRM Billing similar to the SD Billing extractor "Extraction of SD Billing Conditions" (2LIS_13_VDKON)?
    If there is no standard extractor, is there another way to extract the conditions and the related values?
    I am using the standard CRM Billing Extractor 0BEA_CRMB already, so maybe an append could solve my problem. How can this be done? In what CRM-tables can I find the values from pricing procedure for conditions in CRM Billing?

    you may want to post that last question in a CRM forum... in ECC it would be table KONV

  • How to get the values from table SKB1 R/3  to SRM

    Hi Gurus,
    My requirement is to get all the values from the table SKB1 to SRM (i.e. in to an internal table) for doing some validation(G/L account XXXXXX requires an assignment to a CO objectXXXXXX.)
    Like wise I have many tables for doing validation in SRM
    Help me how to get this, suggest me any Function module with sample code.
    OR
    Any Standard FM which will give all the values of the fields in the table SKB1 when I pass the key fields G/L account & company code alone so that I can improve the performance.
    Suggest me.
    Regards
    Paul

    Hi,
    You can use the FM 's META_READ_TABLE Or RFC_READ_TABLE
    Which SRM / Backend system version are you using ?
    Are you taking care of the Importing paramater - DELIMITER in this case.. ??*
    See related links ->
    Re: Retrieving data from R/3 into SRM
    Re: Product Search TIME lag
    Else you can just call the remote enabled  FM "BAPI_GL_ACC_GETDETAIL"  from SRM.
    BR,
    Disha.
    Do reward points for useufl answers.

  • How to create a dropdown list to list the values from two different tables?

    Hi,
    I have the following requirement:
    1. I have to create a dropdown list to display all the values from the second column of  a table.
    2. Another dropdown list to display all the values from the second column of another table.
    3. A text box should help me to add the selected values.
    How to get this done in a PDF? Please help.
    Regards,
    Latha

    Is this a LC form? Because Acrobat forms have no concept of tables, just
    individual fields...

  • Swing: when trying to get the values from a JTable inside an event handler

    Hi,
    I am trying to write a graphical interface to compute the Gauss Elimination procedure for solving linear systems. The class for computing the output of a linear system already works fine on console mode, but I am fighting a little bit to make it work with Swing.
    I put two buttons (plus labels) and a JTextField . The buttons have the following role:
    One of them gets the value from the JTextField and it will be used to the system dimension. The other should compute the solution. I also added a JTable so that the user can type the values in the screen.
    So whenever the user hits the button Dimensiona the program should retrieve the values from the table cells and pass them to a 2D Array. However, the program throws a NullPointerException when I try to
    do it. I have put the code for copying this Matrix inside a method and I call it from the inner class event handler.
    I would thank you very much for the help.
    Daniel V. Gomes
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import AdvanceMath.*;
    public class MathF2 extends JFrame {
    private JTextField ArrayOfFields[];
    private JTextField DimOfSis;
    private JButton Calcular;
    private JButton Ativar;
    private JLabel label1;
    private JLabel label2;
    private Container container;
    private int value;
    private JTable DataTable;
    private double[][] A;
    private double[] B;
    private boolean dimensionado = false;
    private boolean podecalc = false;
    public MathF2 (){
    super("Math Calcs");
    Container container = getContentPane();
    container.setLayout( new FlowLayout(FlowLayout.CENTER) );
    Calcular = new JButton("Resolver");
    Calcular.setEnabled(false);
    Ativar = new JButton("Dimensionar");
    label1 = new JLabel("Clique no bot�o para resolver o sistema.");
    label2 = new JLabel("Qual a ordem do sistema?");
    DimOfSis = new JTextField(4);
    DimOfSis.setText("0");
    JTable DataTable = new JTable(10,10);
    container.add(label2);
    container.add(DimOfSis);
    container.add(Ativar);
    container.add(label1);
    container.add(Calcular);
    container.add(DataTable);
    for ( int i = 0; i < 10 ; i ++ ){
    for ( int j = 0 ; j < 10 ; j++) {
    DataTable.setValueAt("0",i,j);
    myHandler handler = new myHandler();
    Calcular.addActionListener(handler);
    Ativar.addActionListener(handler);
    setSize( 500 , 500 );
    setVisible( true );
    public static void main ( String args[] ){
    MathF2 application = new MathF2();
    application.addWindowListener(
    new WindowAdapter(){
    public void windowClosing (WindowEvent event)
    System.exit( 0 );
    private class myHandler implements ActionListener {
    public void actionPerformed ( ActionEvent event ){
    if ( event.getSource()== Calcular ) {
    if ( event.getSource()== Ativar ) {
    //dimensiona a Matriz A
    if (dimensionado == false) {
    if (DimOfSis.getText()=="0") {
    value = 2;
    } else {
    value = Integer.parseInt(DimOfSis.getText());
    dimensionado = true;
    Ativar.setEnabled(false);
    System.out.println(value);
    } else {
    Ativar.setEnabled(false);
    Calcular.setEnabled(true);
    podecalc = true;
    try {
    InitValores( DataTable, value );
    } catch (Exception e) {
    System.out.println("Erro ao criar matriz" + e );
    private class myHandler2 implements ItemListener {
    public void itemStateChanged( ItemEvent event ){
    private void InitValores( JTable table, int n ) {
    A = new double[n][n];
    B = new double[n];
    javax.swing.table.TableModel model = table.getModel();
    for ( int i = 0 ; i < n ; i++ ){
    for (int j = 0 ; j < n ; j++ ){
    Object temp1 = model.getValueAt(i,j);
    String temp2 = String.valueOf(temp1);
    A[i][j] = Double.parseDouble(temp2);

    What I did is set up a :
    // This code will setup a listener for the table to handle a selection
    players.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = players.getSelectionModel();
    rowSM.addListSelectionListener(new Delete_Player_row_Selection(this));
    //Class will take the event and call a method inside the Delete_Player object.
    class Delete_Player_row_Selection
    implements javax.swing.event.ListSelectionListener
    Delete_Player adaptee;
    Delete_Player_row_Selection (Delete_Player temp)
    adaptee = temp;
    public void valueChanged (ListSelectionEvent listSelectionEvent)
    adaptee.row_Selection(listSelectionEvent);
    in the row_Selection function
    if(ex.getValueIsAdjusting()) //To remove double selection
    return;
    ListSelectionModel lsm = (ListSelectionModel) ex.getSource();
    if(lsm.isSelectionEmpty())
    System.out.println("EMtpy");
    else
    int selected_row = lsm.getMinSelectionIndex();
    ResultSetTableModel model = (ResultSetTableModel) players.getModel();
    String name = (String) model.getValueAt(selected_row, 1);
    Integer id = (Integer) model.getValueAt(selected_row, 3);
    This is how I got info out of a table when the user selected it

  • Get the values from Variants

    I am missing the values from variants..does have anybody have an idea how to retrieve the values of variants..?
    Is it stored some where in SAP..?in any table..?
    Any help would be appreciated.
    Thanks,
    Frank

    Are you having variant problems after an upgrade? If so, you can run:
    RSVARDOC                       Rescue obsolete variants
    or
    RSVARDOC_610                   Rescue obsolete variants
    Depending on your version.
    Rob

  • Get the values from Day 1 of the Month

    Hi Friends,
    I have a requirement in which I have to Get the values from Day 1 of the Month.
    Ex : If I enter 19 - 07 - 2007.......the report should display Values from 01 - 07 - 2007.
    How to Code ?
    Please provide the Code.
    Thank you.

    Hello ,
              Check this code,
    DATA: test_datum1      LIKE sy-datum,
               test_datum2      LIKE sy-datum.
    WHEN 'TEST1'.
              IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'TEST2'.
            test_datum1      = loc_var_range-low.
        CONCATENATE test_datum1(6) '01' INTO  test_datum2.
        CLEAR l_s_range.
        l_s_range-low   = test_datum2.
        l_s_range-high  = test_datum1.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'BT'.
        APPEND l_s_range TO e_t_range.
    hope it helps,
    assign points if useful

  • How to retrieve the values from a table if they differ in Unit of Measure

    How to retrieve the values from a table if they differ in Unit of Measure?

    If no data is read
    - Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
    If no quanity in result internal table
    - There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
    - - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
    - - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
    * Fill the internal table
    SELECT msehi adqntp
      INTO TABLE internal table
      FROM lipso2
      WHERE vbeln = wrk_doc1
        AND msehi IN ('KL','K15','MT').
    * If required move the read quantity in the appropriate column.
    LOOP AT internal_table ASSIGNING <fs>.
      CASE <fs>-msehi.
        WHEN 'K15'.
          <fs>-adqnt2 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
        WHEN 'MT'.
          <fs>-adqnt3 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
      ENDCASE.
    ENDLOOP.
    - You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
    Regards,
    Raymond

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • Passing the values from one pgm to another pgm (Calling pgm has no sel scr)

    Hi gurus,
    In my requirement i need to pass the values from one program to another program.
    I am using SUBMIT statement . But , the program which i am calling has no selection screen.
    So how can i pass the values?
    Please help me ASAP.
    Regards,
    Bhanu.R

    Export your internal tables or work areas to a memory id in ur program before u use submit.
    Then in second pgm you have to import from memory id given above.
    example.
    EXPORT gs_header FROM gs_header to memory id 'HEADER'.
    EXPORT gt_item FROM gt_item to memory id 'ITEM'.
    SUBMIT YFIIN_DISHC_MAILREPORT EXPORTING LIST TO MEMORY AND RETURN.
    In your second pgm you can write
    import gs_header TO gs_header from MEMORY id 'HEADER'.
    import gt_item TO gt_item from MEMORY id 'ITEM'.

  • Getting the value from a hashtable

    Hi all,
    Can I get the value from a Hashtable by passing vector.toString() , in the get method?
    I am storing the key value pair using the key as vector.toString() as the key and a string value. When i am using the get method by passing vector.toString() I am getting an exception
    found : Object
    required : String.
    Thanks and regards
    Tanmoy

    Exception? "found: X required: Y" sounds more like a compiler error to me.
    You need to post the lines of code that cause the error so we can see what's going on.

  • How to move the value from a character field to numeric or packed decimal

    Hi,
    can anyone explain me on how to move the value from a character field to numeric or packed decimal.
    Please help me on this. Thanks...
    Regards,
    Rose.

    Hi ,
    if you use keyword MOVE u may loose the decimal and thoussan separator and if u don't want to loose them just call the FM ..HRCM_STRING_AMOUNT_CONVERT.
    i doubt wherther it is HRCM or HCRM just try using *
    this will suit ur requirement.
    Regards,
    KK

  • How to copy total freight value from pricing procedure to TAXINN procedure

    Dear Experts,
    I want to copy the total freight value from pricing procedure to TAXINN procedure , i think i have to use SUBROUTINE for that but can you guide me what is the routine number and in which coloum i i have to use e.g. requirement, or ALt CAl Typ, or cond Base value ???
    e.g.
    freight condition type (QTY , freight) will enter manually e.g. 100 Rs and material qty 4 so total freight is 400 Rs this value (400 Rs) i want to copy from Pricing procedure to TAXINN
    How can achieve this ????
    Thanks and regards
    Hanumant Nimbalkar

    Hello,
    If you want to calculate VAT above Freight, then in Pricing procedure make the Sub total as blank for Freight confition types.
    And in Tax procedure, make the condition base value as 363 for VAT condition type.
    Make the tax code for 4 % VAT and u'll get the desired result.
    This will solve ur purpose.
    Regards
    Prabhjot Singh Nayyar

  • Copying the value from a cell in the SQL results?

    I run an sql query. The results are returned in a results window. I would like to copy the value from this cell
    and paste it into an sql query. How can I do this? I can copy and paste a value from a cell in the view of the data in
    a table, but not from the test results. How do I do this? Is there a setting I need to change?

    I usually do this kind of operations and I've never had any issues, the procedure is as simple as CTRL-C in the results grid, with the required column/columns selected and CTRL-V in the worksheet or anywhere else.
    If you still have issues please post your
    - SQLDeveloper version
    - Java Version
    - OS
    - Database Version
    and if you can a small test case.

Maybe you are looking for

  • Macbook pro 13inch freezing playing videos, please help!

    Hello all, Here is the scenario: I have a macbook pro 13" running windows 7 via bootcamp. Recently a window pops up telling me there was a major update available for bootcamp and some other stuff. I downloaded it right away. Even though I was running

  • How to change some partner data for defined partner role?

    Hello SDN! I need to set another ID and address for partner both in header and positions. Data comes from CRM ISA. I'm using extended BADIs with methods IF_EX_CRM_ISA_BASKET_HEADCHANGEHEAD_BEFORE_ORDER and IF_EX_CRM_ISA_BASKET_ITEMSCHANGEITEMS_BEFORE

  • DBAdapter insert only operation issue

    Hi Gurus, I'm trying to create the BPEL SOA composite which is receive the input using File Adapter (file only containt 2 rows) and insert into database table using DBAdapter with Insert only operation using mediator. The data will be inserted to see

  • How to search the content in a Table

    Hi all,     How can i search the content in a table. is there any UI Element is there to do this? Can any body give me any sample code for this regards, VJR

  • Way to count commits and updates in a procedure

    Gday, I want to trace a procedure at runtime to see how many updates and commits are being made when it runs. What is the best way to accomplish this? Cheers