Output from Cursor Reference

Hi all,
We have a table like this:
create table tblSales
(sku varchar2(100),
selling_date date,
sales_vol integer
);Records in this table will be like this:
SKU1             15-JUL-07     300
SKU2                15-JUL-07     400
SKU3             15-JUL-07     500
SKU4                15-JUL-07     600
SKU1             16-JUL-07     500
SKU2                16-JUL-07     600
SKU3             16-JUL-07     700
SKU4                16-JUL-07     800
SKU1             17-JUL-07     250
SKU2                17-JUL-07     300
SKU3             17-JUL-07     550
SKU4                17-JUL-07     480I want the output like:
SKU          15-JUL-02    16-JUL-02        17-JUL-02     18-JUL-02
SKU1              300          500               250           0
SKU2              400          600               300           0
SKU3              500          700               550           0
SKU4              600          800               480           0I am using Oracle 10.1.02 and PL/SQL developer as developing tool. I have found a piece of code from AskTom which is very helpful as below:
create or replace procedure get_query(p_start date, p_end date, p_cursor out SYS_REFCURSOR)
   is
       l_query long := 'select sku ';
   begin
      for i in 1 .. trunc(p_end)-trunc(p_start) + 1
      loop
          l_query := l_query || ', sum( decode( trunc(selling_date), ' ||
                          'to_date( ''' || to_char(p_start+i-1,'dd/mm/yyyy') ||
                          ''', ''dd/mm/yyyy'' ), sales_vol, 0 )) "' ||
                          to_char(p_start+i-1) || '"';
      end loop;
      l_query := l_query || ' from tblSales group by sku';
      open p_cursor for l_query;
end;when I ran the procedure in SQL plus, i was able to get the desired output.
SQL>
SQL>  set autoprint on
SQL>  variable x refcursor
SQL>  exec get_query(to_date('19/06/2005', 'dd/mm/yyyy'), to_date('21/06/2005', 'dd/mm/yyyy'), :x);
  SKU_BKEY  19-JUN-05  20-JUN-05  21-JUN-05
   1235074          0          0          0
   1113006          0          0          0
   1217230          0          0          0
   6552011          0          0          0
   6012969       3607          0          0
   6029089       1956          0          0
   6030825      20098          0          0
   6017078      11273          0          0
   6265298       5318          0          0
   6297515      10504          0          0
      1458     150523          0          0But I can't produce the same output in PL/SQL developer. Why?
SQL> variable x refcursor
REFCURSOR not supported
SQL> exec get_query( :x,to_date('19/06/2005', 'dd/mm/yyyy'), to_date('21/06/2005', 'dd/mm/yyyy'));
begin get_query( :x,to_date('19/06/2005', 'dd/mm/yyyy'), to_date('21/06/2005', 'dd/mm/yyyy')); end;
Cursor variable :X cannot be nil
x
0
SHow can I use this result set. I need to create a report based on this in VBA excel via ADO connection. Is there a way I can export the output to a temp table, and do the select from the temp table. The problem is the columns must be always dynamic, based on the date that user provided. Any idea how can I achieve this?
Thanks very much for your time and help.
Pete
Message was edited by:
lcpx
Message was edited by:
lcpx
Edited by: jkestely on Sep 29, 2008 2:49 PM

Hi,
Thanks very much for your time. I tried to store the ref_cursor in Recordset of VB base on the example you gave, have been spending days but couldn't make this work. Here is my code:
Public Sub PopulateData()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
Dim par1, par2 As ADODB.Parameter
Dim pStartDate, pEndDate As Date
pStartDate = "19/06/2005"
pEndDate = "19/07/2005"
Set conn = New ADODB.Connection
conn.Open "Driver={Microsoft ODBC for Oracle};" & _
"Server=dwl;" & _
"Uid=scott;" & _
"Pwd=tiger"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandText = "get_query"
cmd.CommandType = adCmdStoredProc
Set par1 = cmd.CreateParameter("p_start", adDate, adParamInput)
par1.Value = pStartDate
cmd.Parameters.Append par1
Set par2 = cmd.CreateParameter("p_end", adDate, adParamInput)
par2.Value = pEndDate
cmd.Parameters.Append par2
Set rst = New ADODB.Recordset
Set rst = cmd.Execute
Sheet1. Cells(4, 1).CopyFromRecordset rst
Set cmd = Nothing
Set par1 = Nothing
Set par2 = Nothing
rst.Close
Set rst = Nothing
conn.Close
Set conn = Nothing
End Sub
I am getting an "ODBC Drive does not support the requested properties" error on the Set rst = cmd.Execute line of code.
Thanks again!
Message was edited by:
lcpx

Similar Messages

  • Dispalying output from a REF CURSOR

    Friends,
    I'm getting my self into indepth pl/sql and need some help from you to clear some basic concepts.
    create table MASTER_TABLE
    street_info varchar2(100),
    property_type varchar2(50) ------- i.e values here would be 'HOME_TABLE' ,'COM_PROP_TABLE' etc
    create table HOME_TABLE
    property_id char(5),
    prop_desc varchar2(100),
    cost varchar2(10),
    location varchar2(100)
    create table COM_PROP_TABLE
    property_id char(5),
    prop_desc varchar2(100),
    cost varchar2(10),
    location varchar2(100)
    I want to use a single procedure to open a weak REF CURSOR variable for the appropriate table based on the street address and display all information from that table.
    Here is what I want to to - execute a stored procedure which accepts 1 'in' paramter and 1 'in out ' parameter.
    IN paramter - accepts street address
    IN OUT paramter - depending on address , if it is related to 'Homes' , it should display all information from the HOME Table, else it will display information from the 'Commerical Property' table.
    create or replace package pack_address_info as
    type v_info_type ref cursor;
    end pack_address_info;
    create or replace procedure schema.sp_home_info(v_add in varchar2,v_show in out v_info_type)
    is
    home_type constant integer :=1;
    commercial_type constant integer :=2;
    cursor show_data_cur is
    select property_type from MASTER TABLE where street_info=v_add;
    var_cursor show_data_cur%rowtype;
    begin
    open show_data_cur;
    fetch show_data_cur into var_cursor;
    close show_data_cur;
    if var_cursor.property_type= HOME_TABLE
    then
    open v_show for
    select * from HOME_TABLE where location=v_add;
    elseif var_cursor.table_name = COM_PROP_TABLE
    then
    open v_show for
    select * from COM_PROP_TABLE where location=v_add;
    end if;
    end schema.sp_home_info;
    I can create the package and the stored proc ... but then ???? i'm stuck ;(
    Now , i don't know how to display the output from the HOME TABLE or the COM_PROP_TABLE depending on what the address is entered? Is this code correct. Can you please help me modify this code so that I can achieve my objective.
    This is an example from the book 'Oracle PL/SQL Programming, 4th Edition' under the 'CURSOR' section - 15.6
    Thanks for the help in advance.

    Here is one sample ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.02
    satyaki>
    satyaki>
    satyaki>CREATE OR REPLACE PACKAGE aaa_sat     
      2  AS       
      3     TYPE crs IS REF CURSOR RETURN emp%ROWTYPE;        
      4     FUNCTION fc_retcur (e_no IN NUMBER)
      5     RETURN crs;
      6  END aaa_sat;
      7  /
    Package created.
    Elapsed: 00:00:01.03
    satyaki>
    satyaki>
    satyaki>CREATE OR REPLACE PACKAGE BODY aaa_sat     
      2  AS       
      3    FUNCTION fc_retcur (e_no IN NUMBER)
      4    RETURN crs       
      5    IS         
      6      l_crs   crs;       
      7    BEGIN         
      8      OPEN l_crs FOR
      9      SELECT * FROM emp           
    10      WHERE empno = e_no;          
    11     
    12      RETURN l_crs;       
    13    END;
    14  END aaa_sat;
    15  /
    Package body created.
    Elapsed: 00:00:00.18
    satyaki>
    satyaki>
    satyaki>DECLARE       
      2    l_emp_rec   emp%ROWTYPE;       
      3    l_crs       aaa_sat.crs;     
      4  BEGIN       
      5    l_crs := aaa_sat.fc_retcur (7782);        
      6    LOOP          
      7      FETCH l_crs           
      8      INTO l_emp_rec;           
      9        EXIT WHEN l_crs%NOTFOUND;          
    10          DBMS_OUTPUT.put_line (l_emp_rec.ename);     
    11    END LOOP;        
    12    CLOSE l_crs;    
    13  END;
    14  /
    CLARK
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.40
    satyaki>
    satyaki>Got Me?
    Regards.
    Satyaki De.

  • How to fetch from cursor into plsql collection

    Dear Friends,
    I am trying to understand PLSQL collections. I am trying with the following example.
    CREATE OR REPLACE TYPE emp_obj AS OBJECT
    (     empname          VARCHAR2(100),     empjob          VARCHAR2(50),     empsal          NUMBER);
    CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj;
    CREATE OR REPLACE PACKAGE eg_collection AS
    -- Delcare ref cursor
    TYPE rc IS REF CURSOR;
    -- Procedure
    PROCEDURE eg_collection_proc (out_result OUT rc);
    END;
    CREATE OR REPLACE PACKAGE BODY eg_collection AS
    PROCEDURE eg_collection_proc( out_result OUT rc) AS
    emp_tdt     emp_tbl := emp_tbl(emp_obj('oracle','DBA',100));
    CURSOR c2 IS SELECT ename,job,sal FROM emp WHERE sal > 2000;
    -- Declare a record type to hold the records from cursor and then pass to the collection
    emp_rec emp_obj;
    BEGIN
         OPEN c2;
         LOOP FETCH c1 INTO emp_rec;
              EXIT WHEN c1%NOTFOUND;
              emp_tdt.extend;
    emp_tdt(emp_tdt.count) := emp_rec;
         END LOOP;
         CLOSE c2;
    OPEN out_result FOR SELECT * FROM TABLE(CAST(emp_tdt AS emp_tbl));
    END eg_collection_proc;
    END eg_collection;
    Executing the proc
    variable r refcursor;
    exec eg_collection.eg_collection_proc(:r);
    print r;
    But I am getting compilation error type mismatch found at emp_rec between fetch cursor into variable

    I am trying to understand PLSQL collections. I dont why the code is not working
    SQL> CREATE OR REPLACE TYPE emp_obj AS OBJECT
    2 (
    3      empname          VARCHAR2(100),
    4      empjob          VARCHAR2(50),
    5      empsal          NUMBER
    6 )
    7 /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj
    2 /
    Type created.
    SQL> DECLARE
    2      emp_tdt emp_tbl := emp_tbl ();
    3 BEGIN
    4
    5      emp_tdt.extend;
    6      SELECT emp_obj(ename, job, sal) BULK COLLECT INTO emp_tdt
    7      FROM emp WHERE sal < 4000;
    8
    9      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
    10
    11      emp_tdt.extend;
    12      SELECT ename, job, sal INTO emp_tdt(1).empname, emp_tdt(1).empjob, emp_tdt(1).empsal
    13      FROM emp WHERE empno = 7900;
    14
    15      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
    16
    17 END;
    18 /
    The total count is 13
    The total count is 14
    PL/SQL procedure successfully completed.
    SQL> DECLARE
    2      emp_tdt emp_tbl := emp_tbl ();
    3 BEGIN
    4
    5      emp_tdt.extend;
    6      SELECT ename, job, sal INTO emp_tdt(1).empname, emp_tdt(1).empjob, emp_tdt(1).empsal
    7      FROM emp WHERE empno = 7900;
    8
    9      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
    10
    11      emp_tdt.extend;
    12      SELECT emp_obj(ename, job, sal) BULK COLLECT INTO emp_tdt
    13      FROM emp WHERE sal < 4000;
    14
    15      DBMS_OUTPUT.PUT_LINE ('The total count is ' || emp_tdt.count);
    16 END;
    17 /
    DECLARE
    ERROR at line 1:
    ORA-06530: Reference to uninitialized composite
    ORA-06512: at line 6

  • Printing the Package output from Anonymous block

    Hi,
    I need to call the below package from anonymous block and get the output.
    Could you let me know.
    I tried using this, but i don't get data.
    ===========Anonymous Block=====================================================================
    declare
    var              xxdc.xxdc_sr_log_his_pkg.sr_tbl_type;
    l_sr_idx_bi  BINARY_INTEGER := 0;
    BEGIN
    xxdc.xxdc_sr_log_his_pkg.service_record('14040',var);
    dbms_output.put_line('CLAIM_CREDIT_OFFERS  :'||var(l_sr_idx_bi).qa_credit_offers(l_sr_idx_bi).character1 );
    end;
    =============================================================================================
    ============================================================================================
    Package Spec
    TYPE cr_offer_type IS TABLE OF apps.qa_results_v%ROWTYPE  
    INDEX BY BINARY_INTEGER;
    TYPE sr_rec_type IS RECORD
    (task_status                      apps.jtf_task_statuses_tl.name%TYPE
    ,task_type                        apps.jtf_task_types_tl.name%TYPE
    ,qa_credit_offers                 cr_offer_type
    TYPE sr_tbl_type IS TABLE OF sr_rec_type
    INDEX BY BINARY_INTEGER;
    PROCEDURE  service_record(p_service_req_num IN  VARCHAR2
                                               ,p_service_req_tbl OUT sr_tbl_type
    Package Body
           FOR emp_row_rec IN cur_credit_off
           LOOP
             l_sr_tbl(l_sr_idx_bi).qa_credit_offers(l_sr_idx_bi).character1 := emp_row_rec.character1;
             --dbms_output.put_line( l_sr_tbl(l_sr_idx_bi).qa_credit_offers(l_sr_idx_bi).character1);   --commenting for testing
              l_sr_idx_bi := l_sr_idx_bi + 1;
           END LOOP;
          p_service_req_tbl := l_sr_tbl;
    =============================================================================================
    Thank

    Hi,
    Did you issue the SQL*Plus command
    SET  SERVEROUTPUT  ON
    or, if you're using some other front end, its equivalent?
    Can you ever see output from dbms_output?  For example, what happens when you run this?
    SET  SERVEROUTPUT  ON
    BEGIN
        dbms_output.put_line ('Hello, world!');
    END;
    Since I don't have your tables, I can't actually run your code.  If you'd post CREATE TABLE and INSERT statements, or re-write the package to reference commonly available tables, such as those in the scott schema, then I could test it.

  • Trying to understand what are the parameter/output From debug SNMP timers

    Hi All
    I am trying to understand what are the parameter/output
    From the debug SNMP timers
    Output SNMP timers :
    *Dec 31 11:56:27: SNMP: HC Timer 632DDE28 fired
    *Dec 31 11:56:27: SNMP: HC Timer 632DDE28 rearmed, delay = 5000
    *Dec 31 11:56:32: SNMP: HC Timer 632DDE28 fired
    *Dec 31 11:56:32: SNMP: HC Timer 632DDE28 rearmed, delay = 5000
    *Dec 31 11:56:37: SNMP: HC Timer 632DDE28 fired
    *Dec 31 11:56:37: SNMP: HC Timer 632DDE28 rearmed, delay = 5000
    *Dec 31 11:56:38: SNMP: HC Timer 70B54A70 fired
    *Dec 31 11:56:38: SNMP: HC Timer 70B54A70 rearmed, delay = 20000
    70B54A70 , 632DDE28 „² what this number means.
    5000 , 20000 „² why I have different delay time ( does it means that I have delay for SNMP request )

    The debug messages you are seeing are related to High-Capacity (HC) timers, which manage updates to 64-bit (HC) snmp counters as defined in RFC2233.
    The "fired" and "rearmed" messages indicate when each of these timers
    updates ("fired") the HC snmp counters, and when they should fire next
    (the "rearmed" messages). Higher speed interfaces require updates more often than lower speed interfaces, so you see two examples of that in your debug messages - 5000 ms updates vs 20000 ms update.
    The numbers that are in the messages (i.e. 632DDE28 ) are internal references to the timer that has fired.
    These messages do not indicate any delay in SNMP message processing, but normal SNMP operation of HC counters.

  • Split Output from Select into 2 different Cols

    Hi,
    I am new to oracle dev. Env Oracle 10g R2
    I need a help with the following.
    I have a select query that returns comma separated values.
    Column LIST1 in table svp_1.
    This needs to hold that data returned by the select query.
    Datatype of Column LIST1 varchar2(4000)
    I get the follwing error.
    ORA-19011: Character string buffer too small
    CREATE OR REPLACE PROCEDURE
    sale_temp( pType in Char,lDate in date) as
    cnt number;
    v_error_code NUMBER;
    v_error_msg VARCHAR2(2000);
    cursor c1 is select svp
    from sale
    where type = pType
    var1 c1%ROWTYPE;
    BEGIN
    UPDATE svp_1
    SET LIST1 = ( SELECT LTRIM( xmlagg (xmlelement (c, RTRIM(RELATED_SVP) || ',')).extract ('//text()'), ',' ) AS RELATED_SVP from (
    SELECT rtrim(BASE_SVP) BASE_SVP,
    rtrim(RELATED_SVP) RELATED_SVP
    from
    svp_enc se
    where
    se.effective date<= pDate
    and (se.expiration_date is null or se.expiration_date > plDate )
    and se.base_svp in
    ( var1.svp
    and se.RELATION_TYPE = '4'
    )group by base_svp)
    WHERE type = pType
    commit;
    dbms_output.put_line('UPDATE done' );
    end;
    end loop;
    close c1;
    END ;
    My requirement :
    In need to capture the data from the select query and update the column.
    The data needs to be returned as comma separated values.
    This data can also be split into 2 columns.....ie data split and updated into 2 cols ie LIST1 AND LIST2 ( can be added to existing table).
    What is the best way to do this?
    Is the below approach possilble?
    LOOP through cursor ...check the length of data....for the select query ....check length .if > 3990 byte.....then write into 2 plsql variables.....and update 2 cols....
    Is this apporach right, if so how to do that in the procedure ? Please give an example...
    Are there any other approaches...?
    All I need is to Split Output from Select into 2 different columns and avoid the ORA-19011: Character string buffer too small error.
    Thanks in advance.

    Re: ORA-19011: Character string buffer too small

  • XML output from oracle equivalent to sql server

    Hi,
    I need an equivalent sql server 2005 equivalent output from oracle.
    Tried with DBMS_XMLGEN.getxml, xforest etc. But I am not able to get desired output.
    Could anyone help me in giving a hint to do so.
    Here below i am pasting sql server 2005 query and output, oracle query and output.
    SELECT top 5
    P.process_id AS Ppid,
    P.name AS Pn,
    P.group_id AS Pg,
    P.locked AS Pl,
    P.build AS Pb,
    100 AS qcount,
    200 AS ocount,
    PI.question_id AS PIqid,
    PI.process_id AS PIpid,
    PI.posx AS PIpx,
    PI.posy AS PIpy,
    PI.innertext AS PItext,
    PI.itemtype AS PItype,
    PI.linkfrom AS PIfrom,
    PI.linkto AS PIto,
    PI.associated AS PIas,
    PI.content_id AS PIc,
    PI.exitpoint1_id AS PIe1,
    PI.exitpoint2_id AS PIe2,
    PI.exitpoint3_id AS PIe3,
    PI.resolveidentifier AS PIri,
    PI.libquestion_idfk AS PIlqid,
    PI.followoncall AS PIfoc,
    PI.userinput AS PIui,
    PI.isLocked AS PIstls,
    PI.PreviousAnswer as PIPAns,
    PI.VisibleToAgent as PIVAgent,
    PI.RetryAttempt as PIRetry,
    PI.Tags as PITag,
    PO.option_id AS POoid,
    PO.question_id AS POqid,
    PO.process_id AS popid,
    PO.posx AS POpx,
    PO.posy AS POpy,
    PO.opt_innertext AS POtext,
    PO.opt_linkfrom AS POfrom,
    PO.opt_linkto AS POto,
    PO.libquestion_idfk AS POlqid,
    PO.liboption_idfk AS POloid
    FROM
    dbo.processes_ec AS P WITH (nolock) INNER JOIN
    dbo.vw_ProcessesQuestions_Simulator_v6 AS PI WITH (nolock)
    ON P.process_id = PI.process_id LEFT OUTER JOIN
    dbo.vw_ProcessesOptions_Simulator_v6 AS PO WITH (nolock)
    ON PI.question_id = PO.question_id AND PI.process_id = PO.process_id
    ORDER BY Ppid, PIqid, POoid ASC
    FOR XML AUTO, ELEMENTS
    O/P
    <P>
    <Ppid>450</Ppid>
    <Pn>CBB1015 - Router Firewall Settinngs Process</Pn>
    <Pg>9</Pg>
    <Pl>0</Pl>
    <Pb>5</Pb>
    <qcount>100</qcount>
    <ocount>200</ocount>
    <PI>
    <PIqid>1</PIqid>
    <PIpid>450</PIpid>
    <PIpx>366</PIpx>
    <PIpy>-516</PIpy>
    <PItext>CBB1015 - Router Firewall Settinngs Process</PItext>
    <PItype>Title</PItype>
    <PIto>2</PIto>
    <PO />
    </PI>
    <PI>
    <PIqid>2</PIqid>
    <PIpid>450</PIpid>
    <PIpx>366</PIpx>
    <PIpy>-437</PIpy>
    <PItext>Is the customers PC Firewall turned off?</PItext>
    <PItype>Question</PItype>
    <PIfrom>1</PIfrom>
    <PIto>2.2,2.1</PIto>
    <PO>
    <POoid>1</POoid>
    <POqid>2</POqid>
    <popid>450</popid>
    <POpx>-50</POpx>
    <POpy>70</POpy>
    <POtext>Yes</POtext>
    <POto>5</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>2</POqid>
    <popid>450</popid>
    <POpx>50</POpx>
    <POpy>70</POpy>
    <POtext>No</POtext>
    <POto>3</POto>
    </PO>
    </PI>
    <PI>
    <PIqid>3</PIqid>
    <PIpid>450</PIpid>
    <PIpx>468</PIpx>
    <PIpy>-344</PIpy>
    <PItext>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PItext>
    <PItype>Question</PItype>
    <PIfrom>2.2</PIfrom>
    <PIto>3.2,3.1</PIto>
    <PIc>278</PIc>
    <PO>
    <POoid>1</POoid>
    <POqid>3</POqid>
    <popid>450</popid>
    <POpx>-50</POpx>
    <POpy>70</POpy>
    <POtext>Yes</POtext>
    <POto>5</POto>
    </PO>
    <PO>
    <POoid>2</POoid>
    <POqid>3</POqid>
    <popid>450</popid>
    <POpx>50</POpx>
    <POpy>70</POpy>
    <POtext>No</POtext>
    <POto>4</POto>
    </PO>
    </PI>
    </P>
    Oracle query and output
    select DBMS_XMLGEN.getxml('select * from (SELECT
    P.process_id AS Ppid,
    P.name AS Pn,
    P.group_id AS Pg,
    P.locked AS Pl,
    P.build AS Pb,
    100 AS qcount,
    200 AS ocount,
    PI.question_id AS PIqid,
    PI.process_id AS PIpid,
    PI.posx AS PIpx,
    PI.posy AS PIpy,
    PI.innertext AS PItext,
    PI.itemtype AS PItype,
    PI.linkfrom AS PIfrom,
    PI.linkto AS PIto,
    PI.associated AS PIas,
    PI.content_id AS PIc,
    PI.exitpoint1_id AS PIe1,
    PI.exitpoint2_id AS PIe2,
    PI.exitpoint3_id AS PIe3,
    PI.resolveidentifier AS PIri,
    PI.libquestion_idfk AS PIlqid,
    PI.followoncall AS PIfoc,
    PI.userinput AS PIui,
    PI.isLocked AS PIstls,
    PI.PreviousAnswer as PIPAns,
    PI.VisibleToAgent as PIVAgent,
    PI.RetryAttempt as PIRetry,
    PI.Tags as PITag,
    PO.option_id AS POoid,
    PO.question_id AS POqid,
    PO.process_id AS popid,
    PO.posx AS POpx,
    PO.posy AS POpy,
    PO.opt_innertext AS POtext,
    PO.opt_linkfrom AS POfrom,
    PO.opt_linkto AS POto,
    PO.libquestion_idfk AS POlqid,
    PO.liboption_idfk AS POloid
    FROM
    processes_ec P INNER JOIN
    vw_ProcessesQuestions_Sim_v6 PI
    ON P.process_id = PI.process_id LEFT OUTER JOIN
    vw_ProcessesOptions_Sim_v6 PO
    ON PI.question_id = PO.question_id AND PI.process_id = PO.process_id
    ORDER BY Ppid, PIqid, POoid ASC) where rownum<=5') from dual
    O/P
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <PPID>450</PPID>
    <PN>CBB1015 - Router Firewall Settinngs Process</PN>
    <PG>9</PG>
    <PL>0</PL>
    <PB>5</PB>
    <QCOUNT>100</QCOUNT>
    <OCOUNT>200</OCOUNT>
    <PIQID>1</PIQID>
    <PIPID>450</PIPID>
    <PIPX>366</PIPX>
    <PIPY>-516</PIPY>
    <PITEXT>CBB1015 - Router Firewall Settinngs Process</PITEXT>
    <PITYPE>Title</PITYPE>
    <PITO>2</PITO>
    </ROW>
    <ROW>
    <PPID>450</PPID>
    <PN>CBB1015 - Router Firewall Settinngs Process</PN>
    <PG>9</PG>
    <PL>0</PL>
    <PB>5</PB>
    <QCOUNT>100</QCOUNT>
    <OCOUNT>200</OCOUNT>
    <PIQID>2</PIQID>
    <PIPID>450</PIPID>
    <PIPX>366</PIPX>
    <PIPY>-437</PIPY>
    <PITEXT>Is the customers PC Firewall turned off?</PITEXT>
    <PITYPE>Question</PITYPE>
    <PIFROM>1</PIFROM>
    <PITO>2.2,2.1</PITO>
    <POOID>1</POOID>
    <POQID>2</POQID>
    <POPID>450</POPID>
    <POPX>-50</POPX>
    <POPY>70</POPY>
    <POTEXT>Yes</POTEXT>
    <POTO>5</POTO>
    </ROW>
    <ROW>
    <PPID>450</PPID>
    <PN>CBB1015 - Router Firewall Settinngs Process</PN>
    <PG>9</PG>
    <PL>0</PL>
    <PB>5</PB>
    <QCOUNT>100</QCOUNT>
    <OCOUNT>200</OCOUNT>
    <PIQID>2</PIQID>
    <PIPID>450</PIPID>
    <PIPX>366</PIPX>
    <PIPY>-437</PIPY>
    <PITEXT>Is the customers PC Firewall turned off?</PITEXT>
    <PITYPE>Question</PITYPE>
    <PIFROM>1</PIFROM>
    <PITO>2.2,2.1</PITO>
    <POOID>2</POOID>
    <POQID>2</POQID>
    <POPID>450</POPID>
    <POPX>50</POPX>
    <POPY>70</POPY>
    <POTEXT>No</POTEXT>
    <POTO>3</POTO>
    </ROW>
    <ROW>
    <PPID>450</PPID>
    <PN>CBB1015 - Router Firewall Settinngs Process</PN>
    <PG>9</PG>
    <PL>0</PL>
    <PB>5</PB>
    <QCOUNT>100</QCOUNT>
    <OCOUNT>200</OCOUNT>
    <PIQID>3</PIQID>
    <PIPID>450</PIPID>
    <PIPX>468</PIPX>
    <PIPY>-344</PIPY>
    <PITEXT>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PITEXT>
    <PITYPE>Question</PITYPE>
    <PIFROM>2.2</PIFROM>
    <PITO>3.2,3.1</PITO>
    <PIC>278</PIC>
    <POOID>1</POOID>
    <POQID>3</POQID>
    <POPID>450</POPID>
    <POPX>-50</POPX>
    <POPY>70</POPY>
    <POTEXT>Yes</POTEXT>
    <POTO>5</POTO>
    </ROW>
    <ROW>
    <PPID>450</PPID>
    <PN>CBB1015 - Router Firewall Settinngs Process</PN>
    <PG>9</PG>
    <PL>0</PL>
    <PB>5</PB>
    <QCOUNT>100</QCOUNT>
    <OCOUNT>200</OCOUNT>
    <PIQID>3</PIQID>
    <PIPID>450</PIPID>
    <PIPX>468</PIPX>
    <PIPY>-344</PIPY>
    <PITEXT>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PITEXT>
    <PITYPE>Question</PITYPE>
    <PIFROM>2.2</PIFROM>
    <PITO>3.2,3.1</PITO>
    <PIC>278</PIC>
    <POOID>2</POOID>
    <POQID>3</POQID>
    <POPID>450</POPID>
    <POPX>50</POPX>
    <POPY>70</POPY>
    <POTEXT>No</POTEXT>
    <POTO>4</POTO>
    </ROW>
    </ROWSET>
    Any help really appreciated.
    Thanks in advance

    Here are the links ->
    http://www.psoug.org/reference/xml_functions.html
    http://www.psoug.org/reference/dbms_xmlgen.html
    http://www.adp-gmbh.ch/ora/sql/xmlelement.html
    http://www.oracle-base.com/articles/9i/SQLXML9i.php
    http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96620/toc.htm
    Regards.
    Satyaki De

  • How to pass output from one selection-as input to another selectiion??

    From a user prompt will iniate many user table selections.   And  the outputs  of each table selection will be used as inputs for the next table selection
    I reviewed variable Scope and inner and outer Declare—it would be a great help if some one could give me a  example of the right approach??
    see sample script :
    Thank you so much for your help
    ---------------------------- Section_01_UserInput.sql -------------------------
    -- THIS SECTION OF THE SCRIPT IS TO PROMPT THE USER FOR THE MODEL NAME AND THE ORGANIZATION CODE (e.I...M1,M2,M3...._)
    -- THE ORGANIZATION WHERE MODEL WAS CREATED IS THE ONLY PLACE WHERE YOU WOULD FIND THE BILL_SEQUENCE_ID
    -- THE COMMON ORGANIZATIONS DO NOT HAVE COMPONETS THEY JUST REFERENCE TO THE ORHANIZATION THAT MODEL WAS CREATED
    SET VERIFY OFF
    SET ECHO OFF
    ACCEPT v_assemblyName CHAR DEFAULT myDefaultAssemblyName PROMPT 'Enter Assembly name:'
    ACCEPT v_OrganizationCode CHAR DEFAULT myDefaultOrganizationCode PROMPT 'Enter the Org where the MODEL WAS CREATED :'
    SELECT a.organization_code, a.organization_id, b.inventory_item_id, b.segment1, b.description
    FROM mtl_parameters a, mtl_system_items_b b
    WHERE a.organization_code = '&v_OrganizationCode'
    AND
    b.segment1 ='&v_assemblyName'
    AND
    b.organization_id = a.organization_id;
    SET VERIFY ON
    SET ECHO ON
    ----OUTPUT of the Section_01_UserInput.sql QUERY---
    ORGANIZATION_CODE ORGANIZATION_ID INVENTORY_ITEM_ID SEGMENT1 DESCRIPTION
    M1, 207, *[225957]* , CN927779, Sentinel Custom Desktop
    ----------------------------- Section_02_bom_structures_b.sql ------------------
    -- List all option class Bill of Materials for a single ATO or PTO model
    -- List of bill_sequence_id and all component_item_id's that belong to that
    -- bill_sequence_id
    SELECT a.assembly_item_id, a.bill_sequence_id, b.bom_item_type, b.component_item_id
    FROM bom_structures_b a, bom_components_b b
    WHERE a.assembly_item_id = *['225957']*
    AND
    b.bill_sequence_id = a.bill_sequence_id
    AND
    b.bom_item_type = '2'; -- OPTION Class's are identified by bom_item_type
    ----OUTPUT of the Section_02_bom_structures_b.sql  QUERY---
    ASSEMBLY_ITEM_ID ORGANIZATION_ID BILL_SEQUENCE_ID BOM_ITEM_TYPE BILL_SEQUENCE_ID COMPONENT_ITEM_ID
    *[225957]* , 207 , *[90754]* 2 90754 *[297]*
    *[225957]* , 207 , *[90754]* 2 90754 *[299]*
    *[225957]* , 207 , *[90754]* 2 90754 *[301]*
    ----------------------------- Section_03A_bom_structures_b.sql-------------------
    -- List all the components under the option class
    -- When no components are found with bom_item_type ='4' which means that this assembly has no
    -- components in the bom_components_b because the assembly is a child that is a option class.
    -- We need to run this script with a bom_item_type ='2' and stored the component_item_id into MEMORY_assembly_id
    -- and run script again by read from MEMORY_assembly_id and bom_item_type = '4';
    SELECT a.assembly_item_id, a.organization_id, a.bill_sequence_id, b.bom_item_type, b.bill_sequence_id, b.component_item_id
    FROM bom_structures_b a, bom_components_b b
    WHERE a.assembly_item_id = '297'
    AND
    b.bill_sequence_id = a.bill_sequence_id
    AND
    b.bom_item_type = '4';
    ----OUTPUT of the Section_03A_bom_structures_b.sql QUERY---
    ASSEMBLY_ITEM_ID ORGANIZATION_ID BILL_SEQUENCE_ID BOM_ITEM_TYPE BILL_SEQUENCE_ID COMPONENT_ITEM_ID
    *[297]* 207 *[384]* 4 384 *[185]*
    *[297]* 207 *[384]* 4 384 *[241]*
    *[297]* 207 *[384]* 4 384 *[249]*
    *[297]* 207 *[384]* 4 384 *[4747]*
    *[297]* 207 *[384]* 4 384 *[4749]*
    *[297]* 207 *[384]* 4 384 *[4751]*
    =================================================================================================
    note output FROM EACH SELECT  that needs to be passed to the next SELECT statement are *[ ]* for example *['225957'] see below:*
    ----OUTPUT of the Section_01_UserInput.sql QUERY---
    ORGANIZATION_CODE ORGANIZATION_ID INVENTORY_ITEM_ID SEGMENT1 DESCRIPTION
    M1, 207, *[225957]* , CN927779, Sentinel Custom Desktop
    ----OUTPUT of the Section_02_bom_structures_b.sql  QUERY---
    ASSEMBLY_ITEM_ID ORGANIZATION_ID BILL_SEQUENCE_ID BOM_ITEM_TYPE BILL_SEQUENCE_ID COMPONENT_ITEM_ID
    *[225957]* , 207 , *[90754]* 2 90754 *[297]*
    *[225957]* , 207 , *[90754]* 2 90754 *[299]*
    *[225957]* , 207 , *[90754]* 2 90754 *[301]*
    ----OUTPUT of the Section_03A_bom_structures_b.sql QUERY---
    ASSEMBLY_ITEM_ID ORGANIZATION_ID BILL_SEQUENCE_ID BOM_ITEM_TYPE BILL_SEQUENCE_ID COMPONENT_ITEM_ID
    *[297]* 207 *[384]* 4 384 *[185]*
    *[297]* 207 *[384]* 4 384 *[241]*
    *[297]* 207 *[384]* 4 384 *[249]*
    *[297]* 207 *[384]* 4 384 *[4747]*
    *[297]* 207 *[384]* 4 384 *[4749]*
    *[297]* 207 *[384]* 4 384 *[4751]*
    Edited by: user612347 on Mar 16, 2010 4:21 PM
    Edited by: user612347 on Mar 16, 2010 4:57 PM

    Hi,
    Sorry, it's unclear what you want to do.
    Whenever you have a problem, it helps to be as specific as you can.
    Post a little sampel data (CREATE TABLE and INSERT statements) and the results you want from that data. Since your problem involves parameters, give a couple of sets of parameters, and the results you want for each set, given the same data.
    Are you saying that, after the user enters one set of parameters, you will need to run a variation of this query:
    SELECT  a.assembly_item_id, a.organization_id, a.bill_sequence_id, b.bom_item_type, b.bill_sequence_id, b.component_item_id
    FROM    bom_structures_b a, bom_components_b b
    WHERE   a.assembly_item_id = '303'
    AND
            a.organization_id = '207'
    AND
            b.bill_sequence_id = a.bill_sequence_id
    AND
            b.bom_item_type = '4';several times? What will be different each time? Will the hard-coded strings in the WHERE clause ('303', '207' and '4') be values from the earlier query?
    Do you really want to run this query several times, or would you rather run one query, and have it produce results for all the relevant values? (That would probably be eaisest and less error-prone). When you post your desired results, post what you would most like to see. If something else is acceptable, describe it.
    You can write SQL*Plus scripts to use parameters (substitution variables.
    For example, you can write a query that says:
    WHERE   a.assembly_item_id     = '&1'
    AND     a.organization_id      = '&2'
    AND     b.bill_sequence_id      = a.bill_sequence_id
    AND     b.bom_item_type      = '&3';and call it like this
    @Section_03A_bom_structures_b  303  207  4You can have a query output several such rows (for example:
    @Section_03A_bom_structures_b  303  207  4
    @Section_03A_bom_structures_b  304  298  3
    @Section_03A_bom_structures_b  306  99   4), send all of that output to a SPOOL file, and then execute the SPOOL file.

  • What is the proper interpretation of the output from PID vi?

    Can someone clarify the meaning of the output from the NI PID vi's? From the documentation for the PID control toolkit, it appears that the output is an absolute quantity and not a delta (change) to the previous output. The problem I have is that if I am running proportional control only, and the controller is moving into a steady cooling air flow rate to achieve my setpoint temperature, the error goes to zero and the output from the controller drops to zero. This completely ruins the temperature control.
    Simply: assume that the output to the control valve I am using needs 12mA (4-20mA controlled) constant value (flow rate) to maintain my setpoint. When the error goes to zero, the controller output goes to zero. This, of course, leads to terrible oscillation etc.
    Other PID implementations I have used are all delta (change) based. In other words, you calculate a P, I, and D correction to the previous output.
    What am I missing? All of the NI labview PID examples use the output directly to drive I/O, and never use it as a change (delta).
    I read this newsgroup's archives and found a similar question, but the answer was not helpful.
    thanks much in advance!

    Hi Darth,
    You have read the documentation correctly. The output of the PID VI is an absolute value. If you are using a P algorithm then you will need to use the PID Output Rate Limiter VI to control the rate of the oscillation. Your other option is to use a PID algorithm rather than just the P algorithm. The I and D portion of the PID algorithm are based on the current and previous error and output respectively. For further information on how the PID output is calculated please reference chapter 2 of the LabVIEW PID Control Toolset User Manual
    Hope this helps!
    Brooks W.
    National Instruments

  • .DOC output from Documaker 11.5 ?

    Hi,
    Can any one tell me how to generate .DOC output from Documaker like .PDF ?
    We need to change in INI settings. I tried and generated .DOC file but when i opened all are Junk characters in the Word document.
    Please help what changes exactly we need to make in INI files ?
    Note: I have tried generating .RTF format in the output.That's working fine. Then why not .doc ?
    Thanks & Regards,
    RAMAN C
    Edited by: 969704 on Jan 8, 2013 3:39 AM

    There are a lot of options with the RTF Print Driver in Documaker and new features in 12.0 and 12.1. Be sure to review the documentation. To see what's available in 12.1 see the Printers Reference at http://docs.oracle.com/cd/E22582_01/printers_rg.pdf.
    -DA

  • CREATE A BP FROM A REFERENCE

    Hi All, I want to know if there is some way to create a new bp from a reference of one that is created, like R3 when you  create a new customer.
    I hear it can be create whit templates …can someone just give me a hand..
    Thanks

    Hi Silpa,
    In the standard, this isn't possible with the BP. However, you can create a customer as a reference of another existing customer, and then sync this new customer into a new BP. So you can do this indirectly,.
    If you want to create a BP directy as a reference of another BP - sorry, this isn't possible. You would need to copy the BP into another BP using a custom report. You can develop your report along these lines :
    1. The easiest way is to use APIs. Start by calling BUPA_CENTRAL_GET_DETAIL usign the BP number. THis will give you all the central data for the BP - e.g. name, etc. Now, merely feed the output of this module into the module BUPA_CREATE_FROM_DATA. This will create a new BP with the same data of the old BP.
    2. Now that the main BP is ready, you need to start copying the individual datasets - addresses, bank details, roles, Id, industry,etc. This is tricky - the ADD apis - BUPA_ADDRESS_ADD, BUPA_ROLE_ADD, etc can only create one record in a call. So, you need to first get the data of the reference BP using the GET_DETAIL api e.g. : BUPA_ADDRESS_GET_DETAIL, then loop at each returned record, and pass that into the corresponding ADD BAPI.
    3. Be sure to call BAPI_TRANSACTION_COMMIT at the end to commit the data to the DB.
    I hope this helps you.
    Cheers,
    Rishu.

  • Controlling XML Output from a Crystal Report

    Hi guys,
    I need to provide an XML output from one of my reports. The customer has defined his schema and I have tried to implement it using the 'XML Expert" With reference to the two snippets below:
    this is what I want:
    <DEPADDR>ZBTJ</DEPADDR>
        <ACFTYPE>EMB145</ACFTYPE>
    and this is what I get:
    <DEPADDR FieldName="{@DEPADDR}">ZBTJ</DEPADDR>
        <ACFTYPE FieldName="{@ACFTYPE}">EMB145</ACFTYPE>
    Does anyone know how to suppress "FieldName="{@DEPADDR}"" from the output? In the XML Expert Dialog both the name, which prints, and the type, which doesn't, are greyed out so you can't do anything with them. There is a "Suppress XML  Tag" tick box but that seems to have no effect on what is included in the export.
    Thanks in advance
    Richard

    Duplicate of
    Crystal reports with a DB procedure
    Closing and locking this thread
    Ludek

  • Getting data from CURSOR

    Hello everbody,
    I am having a quite funny problem with cursor. I need to get dynamic data from CURSOR.
    Example of calling my cursor is:
    FOR v_item IN c_item(ExampleXML) LOOP
    SELECT TEST_SEQ.nextval INTO pRecord(rLevel).ID;
    pRecord(rLevel).PARENTID   := v_item.PARENTID;
    pRecord(rLevel).CHILDID      := v_item.CHILDID;
    END LOOP;
    With this cursor I am able to get CHILDID and PARENTID from XML file and dynamic ID from sequence. Result set should looks like this:
    ID PARENTID CHILDID
    *1 22 31*
    *2 22 32*
    *3 32 33*
    *4 32 43*
    I have no option to save this data however.
    Is there any way that I can query or use this temporary data from cursor to get something like:
    *SELECT ID from [result set above] WHERE CHILDID = PARENTID*
    So, besicaly, I need to select ID for CHILDID, but where PARENTID is same as CHILIDID.
    Any idea?

    OK, then why not directly :
    INSERT INTO your_target_table (id, childid)
    SELECT test_seq.nextval
         , xtab.CHILDID
    FROM XMLTable(
           XMLNAMESPACES(DEFAULT '...')
         , 'for $item in $Prod//Item
            let $parent_item := $item/../..
            return
            <output>
              <childid>{$item/ItemID}</childid>
              <parentid>{$parent_item/ItemID}</parentid>
            </output>'
          PASSING XMLColumn AS "Prod"
          COLUMNS
            PARENTID VARCHAR2(4000) PATH 'parentid',
            CHILDID  VARCHAR2(4000) PATH 'childid'
         ) xtab
    WHERE xtab.PARENTID = xtab.CHILDID
    ; or even this, with the predicate pushed into the XQuery itself :
    INSERT INTO your_target_table (id, childid)
    SELECT test_seq.nextval
         , xtab.CHILDID
    FROM XMLTable(
           XMLNAMESPACES(DEFAULT '...')
         , 'for $item in $Prod//Item
            let $parent_item := $item/../..
            where $item/ItemID = $parent_item/ItemID
            return
            <output>
              <childid>{$item/ItemID}</childid>
            </output>'
          PASSING XMLColumn AS "Prod"
          COLUMNS
            CHILDID  VARCHAR2(4000) PATH 'childid'
         ) xtab
    ;

  • Firstly hello to all. I'm looking to create a vi that will take a single logged output from a thermocoup​le and monitor the temperatur​e and produce a Boolean when the temperatur​e has stabilised for a pre determined time say 1minuet.

    Firstly hello to all. I’m looking to create a vi that will
    take a single logged output from a thermocouple and monitor the temperature and
    produce a Boolean when the temperature has stabilised for a pre determined time
    say 1minuet. I have managed to find a couple of examples on the forum but one
    will only run on V8.2 and I have V8, the other is for more than one channel
    witch is fine I can always reduce this, but it was the timing feature I was
    having difficulty with. I looking to monitor the temperature of a motor until
    it has stabilised prior to testing and then to use this temperature as a
    reference. Pleas forgive my ignorance if this is a very simple thing but I’ am
    learning and really enjoying it. Thank you in advance for your answers.

    Hi
    Graham, thank you for you reply.
    What I’ am trying to achieve is a vi I can use in a motor
    testing setup, a part of this would be to warm the motor up until the exhaust
    air temperature has stabilised, this takes approximately 10 minuets. I was
    thinking of just letting the motor run for this time and leave it at this, but
    some motors warm up quicker that others and. I am basically looking for a vi with
    an adjustable temperature window of say ±5 C° in 1° increments, timing wise 1minuet
    to 10min the adjustment is so I a can use this for another application. I tried
    to adjust the code I found at the link below but had a little difficulty with
    the timing. Thank you so much for your help it’s much appreciated.
    sine.ni.com/niforum/niforum?forumDU=http://forums.​ni.com/ni/board/message?board.id=170&message.id=25​1017&requireLogin=False

  • Not getting outputs from JavaScript Patch in QC2

    The JavaScript Patch no longer generates outputs from outputs[n]. The outputting of data just stopped.
    An example output generator (no other instructions in the JavaScript patch):
    outputs[0] = "string";
    was sent to an Image With String patch and then to a Billboard patch (the only existing patches). No text appeared in the viewer. When in Editor, the cursor placed over Output #0 shows only:
    Type Virtual
    with no value. The input string into Image With String shows "".
    When disconnecting the JavaScript patch from the Image With String patch and I entered "help", the text help appeared in the viewer.
    I reinstalled Quartz Composer and there was no change. Anyone have any idea what is going on?

    What I've learned: the Tascam 122L has known issues when working with Leopard. Back in the store, I plugged another external card (Presonus Audiobox USB), which immediately worked with the Mac as though they were friends since birth.
    I am rapidly warming to Mainstage.

Maybe you are looking for

  • [SOLVED] libreoffice extension pdfimport do not work

    I have installed the libreoffice-extension-pdfimport (3.3.2-2). But when I try to open a pdf file nothing happens (no error messages, just nothing). I have tried several pdf files (including ones produced by libreoffice itself). I remember that earli

  • Possible to do quintuplets in garage band?

    Hi there, i'm trying use garage band to create audio of a piece of music i have, but i'm having a little trouble. You see, in one bar, I need to use a crotchet, then and eight note quintuplet (five semi quavers) followed by a quarter note triplet, an

  • QuickTime Pro, DVD & Apple TV format

    With QT Pro you can export for Apple TV. I want to do this with some home videos on DVD. But I don't see a way to get the video from the DVD into QT. Am I missing something obvious here? Export seems sort of worthless if you cannot import.

  • FF68 Manual Check Deposit Transaction ...

    Dear All, Whats  the use of FF68 and wats the functionality of FF68 . Thanks in advance Dhanush Edited by: Dhanush on Oct 25, 2008 8:00 AM Edited by: Dhanush on Oct 29, 2008 12:57 AM

  • Selection icons destroyed by AT SELECTION SCREEN OUTPUT

    Hello I have a following code excerpt: AT SELECTION-SCREEN OUTPUT.   LOOP AT SCREEN.     IF screen-name = 'CUSTORDS' OR        screen-name = 'TRNSORDS' OR        screen-name = 'REASONCD'.             screen-input = '1'.     ELSEIF ( screen-group1 = '