Creating Object views using XSU PL/SQL.Please SEE.

Hi,
I am presently using XSU PL/SQL utility with Oracle 9i and using the
DBMS_XMLQuery.newContext(<My Select clause goes here>,and the
DBMS_XMLQuery.getXML()which generates an XML document.
My query is:
I have 2 tables (One master and the other detail table.).
Table : DI_Master
di_num
00001
Table: DI_Details
di_num di_act
00001 ABCD
00001 ANCF
00001 IOPP
Now the XML I'd like is :
<di_num>00001</di_num>
<di_act>
<val>ABCD</val>
<val>ANCF</val>
<val>IOPP</val>
</di_act>
Do I need to create object tables for this,insert data into object tables
and then read this table? It will become an extremely tedious process
I guess an OBJECT view can do what I want.Can anyone please tell me how
to write an object view for the 2 tables please and the get the output as
desired.?

Supposing you have further
nesting of the tables.Then how will you go about doing that.You can have multiple levels of CURSOR expressions (see an example below, not a real-life example, but illustrates the point).
SQL> set long 4000
SQL> select dbms_xmlquery.getXML('select deptno,' ||
  2  'cursor(select empno, cursor(select losal, hisal from salgrade) salgrades '||
  3   'from emp e where e.deptno = d.deptno and rownum < 3) EMPLOYEES ' ||
  4  'from dept d where d.deptno = 10')
  5  FROM DUAL;
DBMS_XMLQUERY.GETXML('SELECTDEPTNO,'||'CURSOR(SELECTEMPNO,CURSOR(SELECTLOSAL,HIS
<?xml version = '1.0'?>
<ROWSET>
   <ROW num="1">
      <DEPTNO>10</DEPTNO>
      <EMPLOYEES>
         <EMPLOYEES_ROW num="1">
            <EMPNO>7782</EMPNO>
            <SALGRADES>
               <SALGRADES_ROW num="1">
                  <LOSAL>700</LOSAL>
                  <HISAL>1200</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="2">
                  <LOSAL>1201</LOSAL>
                  <HISAL>1400</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="3">
                  <LOSAL>1401</LOSAL>
                  <HISAL>2000</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="4">
                  <LOSAL>2001</LOSAL>
                  <HISAL>3000</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="5">
                  <LOSAL>3001</LOSAL>
                  <HISAL>9999</HISAL>
               </SALGRADES_ROW>
            </SALGRADES>
         </EMPLOYEES_ROW>
         <EMPLOYEES_ROW num="2">
            <EMPNO>7839</EMPNO>
            <SALGRADES>
               <SALGRADES_ROW num="1">
                  <LOSAL>700</LOSAL>
                  <HISAL>1200</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="2">
                  <LOSAL>1201</LOSAL>
                  <HISAL>1400</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="3">
                  <LOSAL>1401</LOSAL>
                  <HISAL>2000</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="4">
                  <LOSAL>2001</LOSAL>
                  <HISAL>3000</HISAL>
               </SALGRADES_ROW>
               <SALGRADES_ROW num="5">
                  <LOSAL>3001</LOSAL>
                  <HISAL>9999</HISAL>
               </SALGRADES_ROW>
            </SALGRADES>
         </EMPLOYEES_ROW>
      </EMPLOYEES>
   </ROW>
</ROWSET>
1 row selected.
SQL>
Also,isnt it a better option to create a VIEW of the
Select clause and pass a view to the select clause? At the end of the day, you could use whatever you feel comfortable with, provided that it produces your expected output and looks clean. We are just giving you the ideas, how you implement it actually in your situation, depends upon a lot of factors, that only you know about.

Similar Messages

  • Creating Views using XSU PL/SQL API.Urgent please.

    Folks,
    I need some help in creating a View.
    I am using XSU PL/SQL to generate an XML Document.
    I have a table (SDI) with 2 cols CMPY_NUM and CPTY_BORG_NUM.
    If the values in these 2 cols are equal then the xml
    value to be returned is 'OURS' else return 'THEIRS'.
    How do I Create this View please?
    The XSU PL/SQL I am using to generate the XML is:
    declare
    queryCtx DBMS_XMLquery.ctxType;
    xmlResult CLOB;
    begin
    queryCtx := DBMS_XMLQuery.newContext('select CMPY_NUM,CPTY_BORG_NUM from SDI');
    xmlResult := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
    end;
    Output
    <?xml version='1.0'?>
    <ROWSET>
         <ROW num="1">
         <CMPY_NUM>1</CMPY_NUM>
    <CPTY_BORG_NUM>2/CPTY_BORG_NUM>
         </ROW>
    <!-- additional rows ... -->
    </ROWSET>
    Please can any one tell me how to create a view that will be used in place
    of the select statement,and returns back OURS or THEIRS
    Create View XML AS

    This is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
    Lose ten culture points.
    Regards, APC

  • Choosing particular columns using XSU PL/SQL API

    Hi ya,
    I have another query regarding XSU PL/SQL API please
    If I dont want to choose all columns but choose particular columns
    in my select clause,how shud I do this.??
    I havent used XSU before,so please forgive my ignorance.
    declare
    queryCtx DBMS_XMLQuery.ctxType;
    result CLOB;
    begin
    -- set the query context.
    queryCtx := DBMS_XMLQuery.newContext('select CHOOSE CERTAIN COLS ONLY from <TABLE>');
    result := DBMS_XMLQuery.getXML(queryCtx); -- get the result
    DBMS_XMLQuery.closeContext(queryCtx); -- close the query handle;
    end;
    Can anyone tell me how to select particulat columnsor some one suggested(Mr Kishore) to use a view?
    I dont want to use 'Select * from <Table>'
    Help really appreciated.
    Rgds

    This is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
    Lose ten culture points.
    Regards, APC

  • Problem in  Creating a view using infotypes PA0001,PA0002,...

    Hi,
    Can anybody please help me how to create a Maintainence view using PA0001,PA0002,PA0003,PA0006,PA0032.
    I tried to create it using se54.
    when i use PA0003 as check table, i am not able to create relations with PA0001,PA0002,PA0032,PA0006.
    Thanks in Advance.
    Vinay.BR

    You can create a view using SE11 as mentioned in the previous answer. Once you created, you can use SE16 to display the content of the view table. However, this does not serve much because you can also see the original table using SE16. Unless you want to generate screen dialog so that the view table can be used in SM30. This method can be done while editing the table in SE11. Click on Utilities->Table maintenance generator. However, this will be considered as a repair (modification to SAP standard) and you need repair key.

  • GP Design Time - what is the purpose of 'Create Object View' option?

    We are running EP 7.01.  When I am in the GP Design Time, and I click on the 'Create Object View' link, I receive the following error:
    The initial exception that caused the request to fail, was:
       java.lang.NullPointerException
        at com.sap.caf.eu.gp.ui.bo.VCreateBasicData.wdDoInit(VCreateBasicData.java:103)
        at com.sap.caf.eu.gp.ui.bo.wdp.InternalVCreateBasicData.wdDoInit(InternalVCreateBasicData.java:159)
        at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
        at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
        at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
        ... 55 more
    What is the purpose of the 'Create Object View' option?  I cannot find it in the documentation.

    Hi Karen,
    The Object Types are used to define the Parameters for the Callable Objects. We Can create the Object Views for the CAF Core Entity services or UME Pricipal Objects such as Users,Roles Groups etc. While creating the Object View we can select either of these and then we can create a view i..e. Select the required attributes from those Business Objects i.e. Entity Services or the Principals. Once we create the Object View, we can use them to define the Parameters for the callable Objects. While defining the parameters for Callable Objects, if you click the dropdown for 'Type', you'll see an entry 'Reference to BO'. If you select the entry, you'll see the list of Object Views you have created and you can select the Object View you want for defining that parameter. In short it means that you can create the Obect Views for the BOs i.e. CAF core Entity services and Pricipals. And then you can define the parameters for the Callable Objects with type 'Refence to BO' pointing to your object views.
    [further Info|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/44/051d496d9c5922e10000000a155369/frameset.htm]
    [Some more Info|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/44/051d496d9c5922e10000000a155369/frameset.htm]
    Regards,
    Ajay

  • Runtime error 429, activeX component cant create object while using netbet pro on windows 7 & 8.1 HELP!!!

    runtime error 429, activeX component cant create object while using netbet pro
    does anyone know what I could do to fix this problem??? netbet pro was't available for a while then it's back but has yet to run

    What's netbet pro?
    I'd recommend asking questions about third party applications in the vendor's forum, not a Microsoft forum meant for admin scripting.
    EDIT: Ah, some gambling website...
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Query to create a view using the following tables

    Hi,
    I am struggling to write the proper query to create a view using three tables.
    I would really be thankful if anyone can help me.
    I am pasting the following script to create the required tables and also insert appropriate data in each of the table.
    create table HR.STUDENT_DETAILS (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOB DATE,
    SEX CHAR(1),
    ACTIVE CHAR(1),
    CONTACT_NUMBER NUMBER(20),
    primary key(STUDENT_ID)
    create table HR.PAYMENT_HEADER (
    PAY_HEADER_ID NUMBER(10),
    DOC_NUM NUMBER(5),
    MONTH_NAME VARCHAR2(10),
    primary key(PAY_HEADER_ID)
    create table HR.PAYMENT_DETAILS (
    HEADER_ID NUMBER(10),
    LINE_ID NUMBER(10),
    STUDENT_ID NUMBER(10),
    CUM_AMOUNT NUMBER(10),
    primary key(HEADER_ID,LINE_ID)
    INSERT ALL
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1112,'James','17-JUN-05','M','Y',23674378)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1113,'David','21-SEP-05','M','Y',24565457)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1114,'Michael','13-JAN-06','M','Y',25436784)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1115,'Joseph','03-JAN-06','M','Y',23435673)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1116,'Juliet','21-MAY-05','F','Y',23234527)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1117,'Monica','25-JUN-05','F','Y',24873245)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1118,'William','05-FEB-05','M','Y',23623245)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1119,'Karen','07-FEB-06','F','Y',26757543)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1120,'Erika','17-AUG-05','F','Y',25435465)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1121,'Noah','16-AUG-05','M','Y',23457645)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1122,'Angelina','28-SEP-05','F','Y',26456787)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1123,'Gabriela','30-SEP-05','F','Y',29767543)
    INTO HR.STUDENT_DETAILS (STUDENT_ID,STUDENT_NAME,DOB,SEX,ACTIVE,CONTACT_NUMBER) VALUES (1124,'Sofia','07-MAR-06','F','Y',27656578)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (305,1,'JAN')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (306,2,'FEB')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (307,3,'MAR')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (308,4,'APR')
    INTO HR.PAYMENT_HEADER (PAY_HEADER_ID,DOC_NUM,MONTH_NAME) VALUES (309,5,'MAY')
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,12,1112,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,13,1113,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (305,14,1114,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,15,1112,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,16,1113,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,17,1114,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,18,1115,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (306,19,1116,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,20,1112,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,21,1113,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,22,1114,120)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,23,1115,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,24,1116,80)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,25,1117,40)
    INTO HR.PAYMENT_DETAILS (HEADER_ID,LINE_ID,STUDENT_ID,CUM_AMOUNT) VALUES (307,26,1118,40)
    SELECT * FROM DUAL;
    The above table STUDENT_DETAILS stores the details of all the students and each student has a unique student id.
    Another table PAYMENT_HEADER saves the payment details as a document for each month which has a header id.
    In the PAYMENT_DETAILS table, payment details are stored for the students (who made the payment for that month). This table does not save the data for a student if he has not paid on that month. This table is connected to the PAYMENT_HEADER table through a header Id.
    The view should be such that when I pass the document number, it shall show the names of all the students, but shall show payment amount only for those students who had paid under the selected document number, for other it should show null.
    I tried the following query:
    select * from (
    select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
    from hr.student_details sd left join
    (select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
    from hr.payment_header hdr, hr.payment_details det
    where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
    But when I pass the filtering values like document number, it does not show some students with null values.
    select * from (
    select sd.student_name,sd.DOB,sd.sex,sd.contact_number,pd.doc_num,pd.month_name,pd.cum_amount
    from hr.student_details sd left join
    (select hdr.doc_num,hdr.month_name,det.student_id,det.cum_amount
    from hr.payment_header hdr, hr.payment_details det
    where hdr.pay_header_id = det.header_id) pd on sd.student_id = pd.student_id)
    where doc_num = 1 or doc_num is null;
    My requirement is that, every time I use a document number in the where clause for the view it should show the paid amount against the student names who has paid on that month and for all other student it should null. Total student number is 13. So every time it should show 13 students only even when I pass document No 2 or 3.
    Seeking your help.
    Regards
    Hawker

    Hi Frank,
    as per your advice, I am omitting the 'DOB', 'GENDER','ACTIVE','CONTACT_NUMBER' fields from the 'STUDENT_DETAILS' table.
    I shall create separate tables and insert the desired output from the view for each where clause.
    First let us create three tables each for the desired out put:
    1) For the desired output I want to see when I pass doc_num as 1
    create table HR.SDT_PAY_DET_DOC_ONE (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    2) For the desired output I want to see when I pass doc_num as 2
    create table HR.SDT_PAY_DET_DOC_TWO (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    3) For the desired output I want to see when I pass doc_num as 3
    create table HR.SDT_PAY_DET_DOC_THREE (
    STUDENT_ID NUMBER(10),
    STUDENT_NAME VARCHAR2(50),
    DOC_NUM NUMBER(5),
    C_AMOUNT NUMBER(10),
    primary key(STUDENT_ID)
    Now I shall insert values in each of the above three tables:
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',1,40)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_ONE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',2,80)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',2,40)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',2,40)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_TWO(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    INSERT ALL
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1112,'James',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1113,'David',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1114,'Michael',3,120)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1115,'Joseph',3,80)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1116,'Juliet',3,80)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1117,'Monica',3,40)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1118,'William',3,40)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1119,'Karen',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1120,'Erika',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1121,'Noah',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1122,'Angelina',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1123,'Gabriela',null,null)
    INTO HR.SDT_PAY_DET_DOC_THREE(STUDENT_ID,STUDENT_NAME,DOC_NUM,C_AMOUNT) VALUES (1124,'Sofia',null,null)
    SELECT * FROM DUAL;
    Thanks & Regards
    Hawker

  • Create a view using a select statement

    Hi
    I need to create a view using a select statement to view details from 2 different tables which will only show data where the holidays commence after june.
    I am new to oracle so any help will do.
    Thanks

    Hi
    I need to create a view using a select statement to view details from 2 different tables which will only show data where the holidays commence after june.
    I am new to oracle so any help will do.
    Thanks

  • How to create MRP view using BO BUS1001006 & Method CreateViews.

    Guys,
    I need to create MRP view using BO BUS1001006 & Method CreateViews.
    i am not able to unterstand, what i need to specify to create MRP view, other than material number.
    what field i need to send for MRP view.
    Regards.
    santosh.
    Edited by: santosh koraddi on Jun 23, 2010 6:14 PM

    Hi,
    I have a similar question, have done a search and I see this sort of thing has come up a few times but with no definitive answer.... this thread seems close but don't really understand the solution (I'm not an ABAPER)
    I have a material master creation workflow under construction, it uses BUS1001006 and method createviews.
    The issues is that I want to restrict creation of certain views to certain agents, I have a fork in my workflow and its meant to split up the various views for various agents.
    The problem is that if an agent in one of the forks completes their views the workflow tries to get them to completes teh other views which they do not have authoisation to do... anyway the end result is that the workflow thinks all teh views have been created and the workflow items dissappear from the others inboxes.
    How do I setup my workflow such that each agent in each fork only has to complete the views they have authorisation to maintain and leaves work items in the inboxes of other agents for them to complete?

  • Cannot create Materialized View using PL/SQL procedure

    Hello,
    I have a question related to Materialized View creation.
    I have a stored procedure that creates materialized view. When trying to run this procedure I get insufficient privileges error: ORA-01031.
    When I run content of this procedure as anonymous PL/SQL block them materialized view is created without any complications.
    Can you please advice me on that topic?
    Is it even possible to create materialized view in stored procedure as I haven't found an info on it.
    Thanks
    Petr

    Hi chudapet,
    Whenever you do operation in procedure you need to have direct grants and not via a role.
    Most probably the grant to create materialized view is available via a role to your user.
    Assign direct grant to the user:
    grant create materialized view to scott;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • HELP WITH CREATING A VIEW USING PL/SQL

    Hello,
    I have two tables, one is simply an audit version of the other and anytime data is updated, modified, or deleted the data is copied to the audit table (via a trigger) and the audit table records who made the changes and when.
    Here is the description of one of the archive tables:
    AUD_OBLIGATION_ID NOT NULL NUMBER(10)
    OBLIGATION_ID NUMBER(10)
    COMMUNICATION_ID NUMBER(10)
    COMMUNICATION_ID_OLD NUMBER(10)
    OBL_DESC VARCHAR2(4000)
    OBL_DESC_OLD VARCHAR2(4000)
    OBL_TYPE VARCHAR2(20)
    OBL_TYPE_OLD VARCHAR2(20)
    ORIGINAL_TARGET_DATE DATE
    ORIGINAL_TARGET_DATE_OLD DATE
    TARGET_DATE DATE
    TARGET_DATE_OLD DATE
    ACTUAL_DATE DATE
    ACTUAL_DATE_OLD DATE
    STATUS VARCHAR2(20)
    STATUS_OLD VARCHAR2(20)
    DOCLINK VARCHAR2(200)
    DOCLINK_OLD VARCHAR2(200)
    SERIAL_NUMBER NUMBER(10)
    SERIAL_NUMBER_OLD NUMBER(10)
    REMARKS VARCHAR2(200)
    REMARKS_OLD VARCHAR2(200)
    CREATED_BY VARCHAR2(10)
    CREATED_BY_OLD VARCHAR2(10)
    CREATION_TS DATE
    CREATION_TS_OLD DATE
    MODIFIED_BY VARCHAR2(10)
    MODIFIED_BY_OLD VARCHAR2(10)
    MODIFICATION_TS DATE
    MODIFICATION_TS_OLD DATE
    UPDATED_BY VARCHAR2(10)
    UPDATED_TS DATE
    ACTION_TYPE VARCHAR2(10)
    I now need to create a view of this audit table, but do not want to list all the columns from the audit table, instead I would like it to look like this:
    Modification_TS ** Action_Type ** Updated_By ** CHANGES
    Where CHANGES would be a variable that stores the concatenated new & old values (if they are different).
    I assume I need to create a stored procedure using PL/SQL to find these values then insert the values into a view...but all of my efforts do not seem to work.
    Here is the procedure I've written:
    CREATE OR REPLACE PROCEDURE proc_AUD_OBLIGATIONS AS
    modData VARCHAR2(2000) :=' ';
    emp VARCHAR2(200);
    actType VARCHAR2(100);
    actDate DATE;
    obUser VARCHAR2(500);
    CURSOR cur_AUD_OBLIGATION IS
    SELECT o.UPDATED_TS, o.UPDATED_BY, o.OBLIGATION_ID, o.COMMUNICATION_ID,o.COMMUNICATION_ID_OLD,o.OBL_DESC,o.OBL_DESC_OLD,
    o.OBL_TYPE, o.OBL_TYPE_OLD, o.ORIGINAL_TARGET_DATE,o.ORIGINAL_TARGET_DATE_OLD,o.TARGET_DATE,o.TARGET_DATE_OLD,
    o.ACTUAL_DATE,o.ACTUAL_DATE_OLD,o.STATUS,o.STATUS_OLD,o.DOCLINK,o.DOCLINK_OLD,o.SERIAL_NUMBER,o.SERIAL_NUMBER_OLD,
    u.FNAME || ' ' ||u.LNAME AS EMPLOYEE,o.ACTION_TYPE
    FROM AUD_OBLIGATION o, TRAC_USER u, OBLIGATION_USER ou
    WHERE o.OBLIGATION_ID = ou.OBLIGATION_ID
    AND
    ou.TRAC_USER_ID = u.TRAC_USER_ID;
    i_AUD_OBLIGATION cur_AUD_OBLIGATION%rowtype;
    BEGIN
    for i_AUD_OBLIGATION in cur_AUD_OBLIGATION loop
    actType := i_AUD_OBLIGATION.ACTION_TYPE;
    actDate := i_AUD_OBLIGATION.UPDATED_TS;
    emp := i_AUD_OBLIGATION.UPDATED_BY;
    IF i_AUD_OBLIGATION.OBL_DESC != i_AUD_OBLIGATION.OBL_DESC_OLD
    THEN modData := 'OBL. DESC. was: ' || i_AUD_OBLIGATION.OBL_DESC_OLD
    || 'It is now: ' ||i_AUD_OBLIGATION.OBL_DESC;
    ELSE modData := modData;
    END IF;
    IF i_AUD_OBLIGATION.OBL_TYPE != i_AUD_OBLIGATION.OBL_TYPE_OLD
    THEN modData := modData || 'OBL. TYPE. was: ' ||i_AUD_OBLIGATION.OBL_TYPE_OLD
    || 'It is now: ' ||i_AUD_OBLIGATION.OBL_TYPE;
    ELSE modData := modData;
    END IF;
    IF i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE != i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
    THEN modData := modData || 'ORIG.TRGT DATE was: ' || i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
    || 'It is now: ' ||i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE;
    ELSE modData := modData;
    END IF;
    INSERT INTO vw_AUD_OBLIGATIONS VALUES
    (actDate,actType, emp,modData);
    END LOOP;
    END;
    Here is the view I've created, based on this procedure (it does not compile):
    CREATE OR REPLACE VIEW vw_AUD_OBLIGATIONS
    (Action_Date, Action_Type, Action_User, Modified_Data)
    AS
    SELECT actDate,actType, emp,modData
    FROM proc_AUD_OBLIGATIONS
    END;
    Any thoughts on how to make this work - it seems like such a simple concept....
    Thanks in advance
    Tony

    You have a couple of misconceptions here. First, you cannot SELECT from a procedure. You need to write a PROCEDURE that INSERTs these columns into a TABLE, then simply SELECT from the TABLE. There are of course many variations, but I hope you get the general idea here.
    Greg

  • Creating Attribute views using SQL

    Hi experts,
    Can attribute views be created using an SQL command?
    As far as I know all the commands in the HANA modeler are translated eventually to SQL so I guess it should be possible.
    Thanks.

    Hi again,
    Our goal is to dynamically create an attribute view, We're not trying to create a homegrown view but trying to create the attribute view using SQL syntax (like when creating an Analytic Privilege - by providing the XML).
    Maybe I'll try to explain the cause for trying to do so and you could help me with the correct way to do it:
    We develop an application within Information Steward which is called HiVo, we would like to provide record authorization for each role. As we understood the way to do it is by using attribute views and analytic privileges. We have a process which creates our schema on the DB machine (actually it's part of the "deployment" of the application) and the administrator defines the authorization for each role on a UI which is provided on BOE. We would like to take these definitions and combine them with the schema creation which is done programmatically.
    We would like to do it using SQL commands in order to prevent dependency on the modeler SDK which was not used up till now and simplify the process for the administrator not having to use 2 different environments in order to complete the configuration process.
    I hope now things are clearer and maybe you could assist us doing it correctly.
    Again, thank you very much for your support,
    Ran

  • Creating user view using 'createView' method of RemoteSession class

    Hi
    I am trying to create a user view using createView method of RemoteSesson class.
    the code is as follows:
    remoteSession = (RemoteSession)SessionFactory.getSession(REMOTE_HOST, ADMIN_ID, encryptedPassword);
    HashMap map = new HashMap();
    map.put("type", "User");
    map.put("viewId", "User");
    GenericObject obj =
    remoteSession.createView("#ID#3DA2A7588B5510DC:-4D08423:10AAD335A14:-7FEE", map);
    I get the following error on the server side:
    WavesetException: Missing object type
    com.waveset.util.WavesetException: Missing object type
         at com.waveset.util.WavesetException.checkBreakpoint(WavesetException.java:366)
         at com.waveset.util.WavesetException.<init>(WavesetException.java:133)
         at com.waveset.rpc.GenericMessageHandler.createView(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.waveset.rpc.GenericMessageHandler.request(Unknown Source)
         at com.waveset.rpc.SimpleRpcHandler.doRequest(SimpleRpcHandler.java:164)
         at com.waveset.rpc.SimpleRpcHandler.doRequest(SimpleRpcHandler.java:128)
         at org.openspml.server.SOAPRouter.doPost(SOAPRouter.java:500)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Could anyone tell me what is wrong with this code?
    Thanks!

    hi carlos,
    yes it is possible. as a reference please have a look at this document How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
    basically the steps are the same (adding dependency, public parts, etc.) for a ejb or java project.
    regards,
    christian

  • [Forum FAQ] How do I create calculated measure using AMO in SQL Server Analysis Services?

    Introduction
    In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
    In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
    Prerequisites
    Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
    The multidimensional database AdventureWorks Multidimensional Model 2012
    A SQL Server with SSIS and SSAS installed
    The AMO libraries installed:
    X86 Package (SQL_AS_AMO.msi)
    X64 Package (SQL_AS_AMO.msi)
    Solution
    Here is the detail steps to create calculated measure using AMO in SSAS.
    Open SSDT and create a new SSIS project.
    Drag Script Task to the design surface.
    Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
    Create a connection to connect to SSAS server.
    Rename the connection name to ssas.
    Double click the Script Task to open Script Task Editor.
    Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
    Add AMO reference in the Solution Explore window.
    Copy the script below and paste it into the script.
    Dim objServer As Server
    Dim objDatabase As Database
    Dim strDataBaseID As String
    Dim objCube As Cube
    Dim objMdxScript As MdxScript
    Dim objCommand As Command
    Dim strCommand As String
    objServer = New Server
    objServer.Connect("localhost")
    objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
    strDataBaseID = objDatabase.ID
    If objDatabase.Cubes.Count > 0 Then
    objCube = objDatabase.Cubes("Adventure Works")
    If objCube.MdxScripts.Count > 0 Then
    objMdxScript = objCube.MdxScripts("MdxScript")
    objMdxScript = objCube.MdxScripts(0)
    Else
    objCube.MdxScripts.Add("MdxScript", "MdxScript")
    objMdxScript = objCube.MdxScripts("MdxScript")
    End If
    objCommand = New Command
    strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
    strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
    strCommand = strCommand & " VISIBLE = 1 ; "
    objCommand.Text = strCommand
    objMdxScript.Commands.Add(objCommand)
    objMdxScript.Update()
    objCube.Update()
    End If
    objServer.Disconnect()
    Then you can run this SSIS package to create the calculated measure.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Creating a view using With causes ORA-00600 Error

    Hello Ladies and Gents,
    I've been trying to deploy a recursive query as a view in Oracle XE and Standard Edition, neither to much success.
    The query is located in this question here: http://stackoverflow.com/questions/17358109/how-to-retrieve-all-recursive-children-of-parent-row-in-oracle-sq
    with recursion_view(base, parent_id, child_id, qty) as (
       -- first step, get rows to start with
       select
      parent_id base,
      parent_id,
      child_id,
      qty
      from
      md_boms
      union all
      -- subsequent steps
      select
       -- retain base value from previous level
      previous_level.base,
       -- get information from current level
      current_level.parent_id,
      current_level.child_id,
       -- accumulate sum
       (previous_level.qty + current_level.qty) as qty
      from
      recursion_view previous_level,
      md_boms current_level
      where
      current_level.parent_id = previous_level.child_id
    select
      base, parent_id, child_id, qty
    from
      recursion_view
    order by
      base, parent_id, child_id
    The query itself works and returns results. However, when I try to create a view with that query, I receive errors.
    I've posted two screenshots: http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/ViewError.jpg and http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/InternalError.jpg The first one with the ! and * is when I am using JDeveloper 11g, using the Database Navigator, right-click on View and select "New View". I receive the error when I click OK. I can indeed create the view through a sql script, but when I attempt to view the data, I receive the ORA_00600 error.
    I've tried this on both my local machine for XE (version 11.2.0.2.0) and on 11g Standard Edition (11.2.0.2.v6) via Amazon Web Services. The result is the same.
    Does anyone know how to get around this?

    Not 5 minutes after I post this, I decide not to use JDev's graphical editor, and simply write
    SELECT * FROM BOMS_VIEW;
    And it works like a charm.  I just can't use data tab to view the records in the editor.  Wish I had known that 5 hours ago.

Maybe you are looking for

  • How do I remove credit card info from iTunes Store account?

    How do I remove credit card information from my iTunes account?

  • Resize html image in email signature

    Hi, I have been trying to insert my company logo in my email signature on Outlook Client 2013 but the results have been disappointing. Would greatly appreciate your assistance. Thank you in advance! My company logo is in png-format. Its dimensions ar

  • Newbie Help? Audio Out Of Sync After Capture

    Please help a newbie to this great forum: I use Final Cut Pro HD and import Sony DV tapes which were shot with a Sony VX-2000. Once recorded, I Log and Capture the tapes as I play them on a Sony GV-D 1000 NTSC player - the little "Walkman" of DV tape

  • MulitCam editing and color correcting each cam

    I do a lot of 4 or 5 camera editing of some concerts and I always have to go through each shot and tweak the colors. This time I'm taking the original clip, color correcting, exporting then using the exported clip in my multiclip editor. Is there a q

  • System Clipboard with KDE

    Just wondering if anyone else has encountered this. I have a bunch of users using an application mostly on either windows, Linux with Gnome and Linux with KDE. Sometimes, and only on KDE, pasting stuff from the System clipboard causes the application