How to execute a procedure depending on the result of a query?

Hello, I'm new in ODI.
I want to execute a procedure depending on the result of a query Oracle table.
We have a Oracle Table whit a column that contains two possibles values.
I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
How can i do?

what you need to do is
1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
2. copy "new_var2" to the package screen.
3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
4. copy "new_var1" into your package (some where in the flow)
5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
8 you now join "new_var2" to "new_var2_E" with OK
9 you join "new_var2_E" to "new_var1"
10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
13. the relevant procedure to "new_var2_D" with an OK
14. join the "new_var2_D" to the "new_var2_E" with an OK
15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
Hope this helps, sorry it is a little long winded..
Edited by: DavidGD on Feb 8, 2009 3:29 PM

Similar Messages

  • How to execute a function and return the result into a bind variable

    Hi,
    I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
    create or replace function total_income
    +(v_job_id IN varchar2)+
    RETURN number IS
    v_total number(6);
    cursor get_sal is
    select salary from employees
    where job_id = v_job_id;
    BEGIN
    v_total := 0;
    for emp in get_sal
    loop
    v_total := v_total emp.salary;+
    end loop;
    dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
    return v_total;
    END;
    Now I woud like to execute this function and assign the returned value into a bind variable test_sal
    variable test_sal number(6)
    SELECT total_income('AD_VP') into :test_sal FROM DUAL;
    dbms_output.put_line('Total Sal:'||:test_sal);
    This is returning the below errors:
    SELECT total_income('AD_VP') into :test_sal FROM DUAL
    *+
    Error at line 0
    ORA-01036: illegal variable name/number
    dbms_output.put_line('Total Sal:'||:test_sal);
    Error at line 3
    ORA-00900: invalid SQL statement
    Could someone help me what could be the problem?? Thanks for your time...

    Dear,
    If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
    When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
    The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
    So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
    Best regards
    Mohamed Houri

  • [LV - TS] How to execute a SEQ file, get the result (PASS/FAIL) and the report file ?

    Hello,
    I'm looking for the most obvious and simple way to, from Labview :
    1- Start the Teststand engine : DONE
    2- Get a list of SEQ files to execute : DONE
    3- Loop through the list to execute each SEQ file : <- found some examples but I have some trouble with the UIMessage stuff
    http://zone.ni.com/reference/en-XX/help/370052N-01/tsexamples/infotopics/executing_sequences_using_api_labview/
    4- Get the result of the SEQ execution : <- unsure
    5- Get the XML path+name of the report file generated : <- obviously not easy
    http://digital.ni.com/public.nsf/allkb/3D3B2358DF9B786B8625789500549A3B
    http://forums.ni.com/t5/NI-TestStand/Getting-Report-File-Path-location-at-execution-in-TestStand-2012/td-p/3041789
    Here is my current implementation :
    David Koch
     

    Hello,
    I tried to work from this example :
    http://forums.ni.com/t5/NI-TestStand/Execution-of-TestStand-Sequence-in-LabVIEW-via-TS-API-Different/td-p/2939616/page/2#M46686
    However it remains unclear about how to get a simple
    answer from just running a sequence file out of any
    model so far (Simple Pass). Like I told you, all what
    I need, once the TS engine is started, is a VI with the
    following interface :
    INPUT
    1- TS engine reference
    2- SEQ file path (path or string)
    3- Sequence name to execute
    4- UUT string (optional, but yeah)
    5- error in
    OUTPUT
    1- Result boolean (PASS/FAIL)
    2- Path to XML report
    3- error out
    It would be so cool to just have this
    About the surrounding UI, I'm working on it. The LV
    code is not really important at this point, it's running
    a SEQ file that matters to me.
    David Koch
     

  • How to execute this Procedure and get the output?

    I have created a Procedure the source code of the same is furnished below.
    create or replace procedure vin_test( p_deptno IN number
    , p_cursor OUT SYS_REFCURSOR)
    as
    v_res Emp%rowtype;
    begin
    open p_cursor FOR
    select *
    from emp
    where deptno = p_deptno;
    end vin_test;
    Now, if i want to see the out put of this Proc
    i will first set the Serveroutput on and then..
    Exec vin_test(10);
    I am getting an error saying wrong number of arguments,so can anybody tell me what parameter value should i pass on so that i can get desired output.
    Thanks in Advance
    OraCrazy

    In sqlplus you can do like this.
    SQL> create or replace procedure vin_test( p_deptno IN number, p_cursor OUT SYS_REFCURSOR)
      2  as
      3     v_res Emp%rowtype;
      4  begin
      5     open p_cursor for
      6     select *
      7       from emp
      8      where deptno = p_deptno;
      9  end;
    10  /
    Procedure created.
    SQL> var lcur refcursor
    SQL> exec vin_test(30,:lcur)
    PL/SQL procedure successfully completed.
    SQL> print lcur
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30         10
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30         10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30         10
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30         10
    6 rows selected.Thanks,
    Karthick.

  • Getting the actual size of the result of a query

    Hi,
    I would like to ask if someone knows on how to get an estimate size of the result of a query on a table. To make it more specific, here is an example.
    Let us say I have this table called EMP and it has a column called DATE. I have issued a query like this:
    select * from EMP where DATE < to_date('01-AUG-08');
    I want to get the actual size of the result of the query in bytes or MB. How would i achieve this without creating another table and transferring the data on it.

    You can use SQL*Plus Autotrace to have the data size sent between client and database session:
    SQL> set autotrace traceonly statistics;
    SQL> select * from employees where hire_date < to_date('01/08/08');
    107 rows selected.
    Statistics
            430  recursive calls
              0  db block gets
            123  consistent gets
             11  physical reads
              0  redo size
           9405  bytes sent via SQL*Net to client
            457  bytes received via SQL*Net from client
              9  SQL*Net roundtrips to/from client
              3  sorts (memory)
              0  sorts (disk)
            107  rows processed
    SQL>Edited by: P. Forstmann on 25 janv. 2011 18:55

  • How to write a procedure for update the table

    Hi all
    can any body please tell me how to write a procedure to update the table......
    I have a table with about 10,000 records...........Now I have add a new column and I want to add values for that like
    registration Code Creidits
    13213 BBA
    1232 MCS
    I had add the creidit now i want to update the table.........the new value want to get by SQL like
    Creidit = select creidit from othere_table...........
    Hope u can understand my problem
    Thanks in advance
    Regards
    Shayan
    [email protected]

    Please try the following --
    update Program_reg a
    set TotalCreidit = ( select tot_cr <Accroding to your logic>
                                from Program_reg b
                                where a.Registration = b.Registration
                                and    a.Enrollment = b.Enrollment
                                and    a.code = b.code
    where a.Registration in ( select distinct Registration
                                        from Program_reg );
    N.B.: Not Tested....
    Regards.
    Satyaki De.

  • How to execute closing cockpit after completed the configuration?

    Hi Expert,
           Please help, how to execute closing cockpit after completed the configuration? or if who have a document it will be helpful.
    Best regards,

    components of closing cockpit
    Organizational Hierarchies (Company Codes, Controlling Area, Operating Concern, etc)
    Task List template (Preconfigured templates available)
    Task Lists: Derived from template and extremely crucial for successful definition of the month-end close.
    Dependencies between the tasks
    Monitor
    Detailed information
    5 steps for setting-up Closing Cockpit
    Conduct Planning and Research
    Create the basic template data
    Build the closing template hierarchy structure
    Configure individual tasks
    Change the template to an executable task list
    For delivering the Closing Cockpit successfully, you need to have a clear understanding of the current closing routines, the required tasks, who is responsible for each task, which tasks when executed should affect which level of the organization, and finally a clear process for review and documentation.

  • QM Sceneri: MIC which has it Limits dependent on the results of a MIC.

    QM Scenerio
      The plan has multiple MIC's all with limits. First five MIC's are independent and rest three are having their limits dependent on the results of a MIC eg with a formula. say 0.8X lower limit and 1.1X upper limit of a MIC., where X is the result of the fifth MIC. Similarly the 7th and the 8th MIC's are having limits dependent on the same MIC with different formula.
    This kind of scenerio may be two times in an inspection Plan.
    Can the Gurus kindly give me the solution how to do it.

    No. Nothing that is standard.  You will have to probably look at creating your own custom valuation FM.  SAP allows you to create these FM's and then config them into the system. You would then selection the custom valuation in a sample procedure that you would create for each of these characteristics.   The valuation for the characteristic would then be carried out according to your custom FM.  No spec would be displayed in the inspection lot however.  But he valuation should be possible.
    FF

  • I need return the result of a query on a stored procedure

    I need return the result of a query on a stored procedure, I mean when I execute a stored procedure it returns a result set as a select query.
    Best regards...

    If you want some pl/sql code that can be used in a query as it were a table you may be interested in table functions:
    SQL> create or replace type
      2  t_emp is object (
      3  name            varchar2(30),
      4  hire_date date,
      5  salary       number);
      6  /
    Tipo creato.
    SQL> create or replace type
      2  t_emptab is table of t_emp;
      3  /
    Tipo creato.
    SQL> create or replace function tab_fun(p_dept in number)
      2  return t_emptab is
      3  e t_emptab;
      4  begin
      5    select t_emp(ename,hiredate,sal)
      6      bulk collect into e
      7      from emp
      8     where deptno=p_dept;
      9
    10    return dip;
    11  end;
    12  /
    Funzione creata.
    SQL> select *
      2  from table(tab_fun(20));
    NAME                           HIRE_DATE  SALARY
    SMITH                          17-DIC-80        800
    JONES                          02-APR-81       2975
    SCOTT                          09-DIC-82       3000
    ADAMS                          12-GEN-83       1100
    FORD                           03-DIC-81       3000A procedure cannot be used in a select statement.
    Max
    http://oracleitalia.wordpress.com

  • Procedure to save the output of a query into excel file or flat file

    Procedure to save the output of a query into excel file or flat file
    I want to store the output of my query into a file and then export it from sql server management studio to a desired location using stored procedure.
    I have run the query --
    DECLARE @cmd VARCHAR(255)
    SET @cmd = 'bcp "select * from dbo.test1" queryout "D:\testing2.xlsx;" -U "user-PC\user" -P "" -c '
    Exec xp_cmdshell @cmd
    error message--
    SQLState = 28000, NativeError = 18456
    Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'user-PC\user'.
    NULL
    Goel.Aman

    Hello,
    -T:
    Specifies that the bcp utility connects to SQL Server with a trusted connection using integrated security. The security credentials of the network user,
    login_id, and password are not required. If
    –T is not specified, you need to specify
    –U and –P to successfully log in.
    -U:
    Specifies the login ID used to connect to SQL Server.
    Note: When the bcp utility is connecting to SQL Server with a trusted connection using integrated security, use the
    -T option (trusted connection) instead of the
    user name and password combination
    I would suggest you take a look at the following article:
    bcp Utility: http://technet.microsoft.com/en-us/library/ms162802.aspx
    A similar thread regarding this issue:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b450937f-0ef5-427a-ae3b-115335c0d83c/bcp-connection-error-sqlstate-28000-nativeerror-18456?forum=sqldataaccess
    Regards,
    Elvis Long
    TechNet Community Support

  • My e-mail has quit updating.  Anybody know why or how to get it started back?  The result is that I dont get my e-mails on the phone.

    My e-mail has quit updating. Anybody know why or how to get it started back?  The result is that I can not get e-mails on my phone.

    Thank you for the info re. the main menu. Your answer I used worked; however, the menu bar all the way across is solid black. The only way I can find out the names on the menu is to point the cursor from left to right over the black bar to find "file" "edit" tools", etc. What do I need to do to get these menu titles to be seen?
    As regarding the GMail --the menu bar used to have an envelope symbol which was white and outlined in red. That disappeared. I googled "mail.google.com" to try to get back my email. This didn't work. I then tried to get a different email address and password--after 8-19 attempts, this never worked. My other email (sbcglobal.net) has never returned. So I don't know where that went or how to get it back

  • How long does it take to get the result of hands-on-course test?

    Hi:
    I passed 1Z0-043 and submitted hands-on-course.
    How long does it take to get the result? And how long does it take to get the certificate?
    Another question:
    Is there any place you can search for OCPs?, just to check those people who have fake certificates.
    Saad,

    S.Nayef wrote:
    Hi:
    I passed 1Z0-043 and submitted hands-on-course.Congratulations!
    How long does it take to get the result? And how long does it take to get the certificate?Submitting hands-on-course should take 2-3 weeks. After that, you'll wait approximately 1 month to get certificatre
    Another question:
    Is there any place you can search for OCPs?, just to check those people who have fake certificates.NO there's not
    >
    Saad,

  • How do you use BOBJ SDK to retrieve the results of a query in XML

    I am trying to programatically get the results of a query given the query id
    My old code used BusinessObjects Enterprise Web Services API to  Retrieve a document's contents
    DocumentInformation biDocInfo;
    RetrieveData retBOData = RetrieveData.Factory.newInstance();
    Action[] actions = new Action[1];
    retBOData.setRetrieveView(xmlView);
    biDocInfo = rEngine.getDocumentInformation(queryId, null, actions, null, retBOData);
    (XMLView) biDocInfo.getView();
    Is there an equivalent way to retrieve the results of the query using SAP BusinessObjects BI 3.x Developer SDK Library ?
    Thanks for any information

    Hello.
    Are you wanting to use the BusinessObjects Enterprise SDK along with the Report Engine SDK as opposed to using the Web Services SDK that you were using previously?
    Also, what part of a webi document are you trying to get the XML format of?
    - Whole document
    - Single report within a document
    - Report page of a report
    - Report part within a report
    - All data providers
    - Single data provider
    If you are trying to use Business Objects Enterprise along with the Report Engine SDK, there are numerous samples for the various parts of the webi document that I mentioned above available at the following link:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/JavaReportEngineSDKSamples
    I hope that this information helps.
    Regards.
    - Robert

  • How to show only the result of a query

    Hi experts,
    i need to show only the result of a query (hiding all the rows)
    according to mathematical functions like sum, average, count ets. i need the result to be shown widhwise the query (Horizontal)
    thanks a lot
    Nir

    Hi
    I did get exactly.....but if i m right then you can do this by selecting the keyfigure goto the calculation tab select calculate result as sum or whatever you want to use.
    Regards
    Lalit k Tyagi

  • Send the result of a query by email

    Hi,
    I want to execute a query in a procedure and send the result in an email using the utl_smtp package. I have send a one line messages based on the result received based on a query. But I'm not sure how to send the entire result of the query as a message body. Any help is appreciated. Thanks,

    Doesn't it depend on what you want to send, do you want the results as just text in the e-mail or an attachment? Do you want csv, xls, xml? Once we know what you want to send we can probably give you some guidance on how you might best create the result you want. If you're already sending an e-mail you can easily add an attachment to the e-mail which would probably be your best bet as you don't know the size of the result set (?). I reckon this will be more of an issue around how you turn your results into a format that you can send rather than how you send it.
    Richard

Maybe you are looking for

  • 2 ipods and itunes accounts on one computer

    We have one computer in our home, and it has multiple accounts.  My iTouch is synced with my iTunes account and my nephews iTouch is synced with his iTunes account.  I was in the process of updating his ipod for him so he could use the features on hi

  • Project specific assignments

    Hi! I just cannot figure out how could I make the controller assignments specific for each project. For example I want cc30 to be an AutoFilter cutoff on first track in a project, but in the next project I want it to be the AutoFilter threshold on th

  • Capture data from previous version of record

    Good day all, I have a table that I am trying to capture information from multiple versions of the same record. In this example the record I want is the one that shows iss_stat of '2' and status of '6'. However, since the fields location, address, ci

  • IMac does not connect to wifi on boot

    I own an iMac and run it with OS X 10.7.5.  Ever since system update 10.7.3 (February 2012) my mac more often than not does not connect to wifi on boot.  I have to select diagnostics and connect manually.  I did a design of experiment and have now di

  • E mac only starts up in safe boot

    Having accidently pressed a few keys on the keyboard while not paying much attention to what was happening to my computer it just switched itself off!!! (I think it was the F15 button that was pressed!) Now it only starts in safe mode and I can't get