How a SELECT statement can return the results in XML format

That's it... I want to execute a query that returns all rowset in XML format. How can I do it?
I have Oracle 9i
Thanks
Jaime

9i, or 9iR2 ?. If 9i I would recommend upgrading to 9iR2 and then using the SQL/XML operators.

Similar Messages

  • How to: SELECT statement returns the result in XML format.

    That's it... I want to execute a query that returns all rowset in XML format. How can I do it?
    Using Oracle 8.0 and up.
    Tnx.

    FOR XML is a proprietary Microsoft Hack... It is not supported by Oracle in any release. Oracle 9.2.x includes the SQLXML operators, which are part of the SQL:2003 standard and are the agreed upon (Mircosoft, IBM, Oracle etc) way of generating XML from relational data....
    See http://download-west.oracle.com/docs/cd/B12037_01/appdev.101/b10790/xdb03usg.htm#sthref251

  • How to select State based on the country

    Hi All,
    I have a requirement,i have to dynamically  populate the value in State based on the Country chosen in the drop down.
    Can you please tell me how to achieve this functionality.
    Thanks & Regards,
    Malkit Singh

    Hi, Malkit
    There is  already a cotext mapping for Sate.
    Take a look at this.
    http://scn.sap.com/message/13816883#13816883
    In your case, use these data types.
    element Country  :CountryCode;
    element State   :RegionCode;
    Regards,
    Fred.

  • Returning query results in XML format

    Besides using custom tag library, does anyone know any methods or techniques that i can retrive the query results from database in XML format. for example, i have a table named student in database like this:
    StudentNo  Name   Gender  Degree
    123       Tony    male    B.Comp.Sci.
    456       Tom     male    B.Fiance
    343       Mary    female  B.Accountingso, if i have query select * from table student, i would get someting like the following:
    <row>
    <studentNo>123</studentNo>
    <name>Tony</name>
    <Gender>male</Gender>
    <Degree>B.Comp.Sci</Degree>
    </row>
    <row>
    <studentNo>456</studentNo>
    <name>Tom</name>
    <Gender>male</Gender>
    <Degree>B.Finace</Degree>
    </row>
    The reason i am asking for this is i need query results returned in XML format, so i can wrap XSLT tag around, and apply for HTML, WML, and XHTML template resprectively so i can display them on different terminals. any help is appreciated.

    I have this method in a ResultSetMapper class:
         * Return result sets as an XML stream, with root tag named
         * "results", one "result" tag per row, and "result" child tag
         * names equal to the column name
         * @param query result set
         * @param list of column names to include in the result map
         * @throws SQLException if the query fails
         * @throws JDOMException if the XML stream creation fails
        public static final Document toJDOM(ResultSet rs, List wantedColumnNames)
            throws SQLException, JDOMException
            Element rows         = new Element("results");
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Element row = new Element("result");
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.addContent(new Element(columnName).setText(value.toString()));
                rows.addContent(row);
            return new Document(rows);
        }It uses JDOM from www.jdom.org. - MOD

  • How to get the metadata (in xml format) of all the fileds in SQl query ?

    Good day ,
    I am using the dbms_xmlgen.getXMLfunction to get the result of any query in xml format.
    With this XML I also want the metadata information about all the fields used in the query (passed to getXML function). Is it possible and how can I achieve this.
    I tried to Google it but couldn't find any solution , it's easy to do it in java where I can get the resultset meta data from the resultset but I have to do it in Oracle function since I want the result in xml format and want to use the oracle XML API.
    You may think why I need metadata , the reason is the application will later use this information to sort the data contained in these fields according to their data type provided to.
    Regards
    Sajjad Ahmed Paracha

    Hi,
    Please always say which version of Oracle you're using (SELECT * FROM v$version).
    With this XML I also want the metadata information about all the fields used in the query (passed to getXML function). Is it possible and how can I achieve this.It is possible but with a bit of effort.
    I would use DBMS_SQL utility to parse the query, extract each column's description and then build a METADATA element with the required information.
    Here's an example (11g) :
    DECLARE
      v_query      varchar2(30) := 'select * from scott.emp';
      v_cur        integer;
      v_desc_tab   dbms_sql.desc_tab;
      v_col_cnt    number;
      v_col_lst    varchar2(4000);
      v_xml_query  varchar2(32767);
      xml_metadata_coll xmlsequencetype := xmlsequencetype();
      xml_metadata      xmltype;
      res          clob;
    BEGIN
      v_cur := dbms_sql.open_cursor;
      dbms_sql.parse(v_cur, v_query, dbms_sql.native);
      dbms_sql.describe_columns(v_cur, v_col_cnt, v_desc_tab);
      dbms_sql.close_cursor(v_cur);
      for i in 1 .. v_col_cnt loop
        if i > 1 then
          v_col_lst := v_col_lst || ', ';
        end if;
        v_col_lst := v_col_lst || v_desc_tab(i).col_name;
        xml_metadata_coll.extend;
        select xmlelement("COLUMN"
               , xmlattributes(v_desc_tab(i).col_name as "name")
               , xmlforest(
                   case v_desc_tab(i).col_type
                     when 1   then 'VARCHAR2'
                     when 2   then 'NUMBER'
                     when 12  then 'DATE'
                     when 180 then 'TIMESTAMP'
                     else 'UNKNOWN'
                   end as "DATATYPE"
                 , v_desc_tab(i).col_max_len as "MAX_LENGTH"
                 , v_desc_tab(i).col_precision as "PRECISION"
                 , v_desc_tab(i).col_scale as "SCALE"
        into xml_metadata_coll(i)
        from dual;
      end loop;
      v_xml_query :=
    'SELECT XMLSerialize(document
             XMLElement("ROOT"
             , :1
             , XMLElement("ROWSET"
               , XMLAgg(
                   XMLElement("ROW", XMLForest(' || v_col_lst || '))
             ) as clob indent
    FROM ( ' || v_query || ')';
      select xmlelement("METADATA", xmlagg(column_value))
      into xml_metadata
      from table(xml_metadata_coll)
      execute immediate v_xml_query into res using xml_metadata;
      dbms_output.put_line(res);
    END;
    /Ouput :
    <ROOT>
      <METADATA>
        <COLUMN name="EMPNO">
          <DATATYPE>NUMBER</DATATYPE>
          <MAX_LENGTH>22</MAX_LENGTH>
          <PRECISION>4</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
        <COLUMN name="ENAME">
          <DATATYPE>VARCHAR2</DATATYPE>
          <MAX_LENGTH>10</MAX_LENGTH>
          <PRECISION>0</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
        <COLUMN name="JOB">
          <DATATYPE>VARCHAR2</DATATYPE>
          <MAX_LENGTH>9</MAX_LENGTH>
          <PRECISION>0</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
        <COLUMN name="MGR">
          <DATATYPE>NUMBER</DATATYPE>
          <MAX_LENGTH>22</MAX_LENGTH>
          <PRECISION>4</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
        <COLUMN name="HIREDATE">
          <DATATYPE>DATE</DATATYPE>
          <MAX_LENGTH>7</MAX_LENGTH>
          <PRECISION>0</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
        <COLUMN name="SAL">
          <DATATYPE>NUMBER</DATATYPE>
          <MAX_LENGTH>22</MAX_LENGTH>
          <PRECISION>7</PRECISION>
          <SCALE>2</SCALE>
        </COLUMN>
        <COLUMN name="COMM">
          <DATATYPE>NUMBER</DATATYPE>
          <MAX_LENGTH>22</MAX_LENGTH>
          <PRECISION>7</PRECISION>
          <SCALE>2</SCALE>
        </COLUMN>
        <COLUMN name="DEPTNO">
          <DATATYPE>NUMBER</DATATYPE>
          <MAX_LENGTH>22</MAX_LENGTH>
          <PRECISION>2</PRECISION>
          <SCALE>0</SCALE>
        </COLUMN>
      </METADATA>
      <ROWSET>
        <ROW>
          <EMPNO>7369</EMPNO>
          <ENAME>SMITH</ENAME>
          <JOB>CLERK</JOB>
          <MGR>7902</MGR>
          <HIREDATE>1980-12-17</HIREDATE>
          <SAL>800</SAL>
          <DEPTNO>20</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7499</EMPNO>
          <ENAME>ALLEN</ENAME>
          <JOB>SALESMAN</JOB>
          <MGR>7698</MGR>
          <HIREDATE>1981-02-20</HIREDATE>
          <SAL>1600</SAL>
          <COMM>300</COMM>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7521</EMPNO>
          <ENAME>WARD</ENAME>
          <JOB>SALESMAN</JOB>
          <MGR>7698</MGR>
          <HIREDATE>1981-02-22</HIREDATE>
          <SAL>1250</SAL>
          <COMM>500</COMM>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7566</EMPNO>
          <ENAME>JONES</ENAME>
          <JOB>MANAGER</JOB>
          <MGR>7839</MGR>
          <HIREDATE>1981-04-02</HIREDATE>
          <SAL>2975</SAL>
          <DEPTNO>20</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7654</EMPNO>
          <ENAME>MARTIN</ENAME>
          <JOB>SALESMAN</JOB>
          <MGR>7698</MGR>
          <HIREDATE>1981-09-28</HIREDATE>
          <SAL>1250</SAL>
          <COMM>1400</COMM>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7698</EMPNO>
          <ENAME>BLAKE</ENAME>
          <JOB>MANAGER</JOB>
          <MGR>7839</MGR>
          <HIREDATE>1981-05-01</HIREDATE>
          <SAL>2850</SAL>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7782</EMPNO>
          <ENAME>CLARK</ENAME>
          <JOB>MANAGER</JOB>
          <MGR>7839</MGR>
          <HIREDATE>1981-06-09</HIREDATE>
          <SAL>2450</SAL>
          <DEPTNO>10</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7839</EMPNO>
          <ENAME>KING</ENAME>
          <JOB>PRESIDENT</JOB>
          <HIREDATE>1981-11-17</HIREDATE>
          <SAL>5000</SAL>
          <DEPTNO>10</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7844</EMPNO>
          <ENAME>TURNER</ENAME>
          <JOB>SALESMAN</JOB>
          <MGR>7698</MGR>
          <HIREDATE>1981-09-08</HIREDATE>
          <SAL>1500</SAL>
          <COMM>0</COMM>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7900</EMPNO>
          <ENAME>JAMES</ENAME>
          <JOB>CLERK</JOB>
          <MGR>7698</MGR>
          <HIREDATE>1981-12-03</HIREDATE>
          <SAL>950</SAL>
          <DEPTNO>30</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7902</EMPNO>
          <ENAME>FORD</ENAME>
          <JOB>ANALYST</JOB>
          <MGR>7566</MGR>
          <HIREDATE>1981-12-03</HIREDATE>
          <SAL>3000</SAL>
          <DEPTNO>20</DEPTNO>
        </ROW>
        <ROW>
          <EMPNO>7934</EMPNO>
          <ENAME>MILLER</ENAME>
          <JOB>CLERK</JOB>
          <MGR>7782</MGR>
          <HIREDATE>1982-01-23</HIREDATE>
          <SAL>1300</SAL>
          <DEPTNO>10</DEPTNO>
        </ROW>
      </ROWSET>
    </ROOT>A couple of comments :
    <li> I handle only four datatypes here (VARCHAR2, NUMBER, DATE, TIMESTAMP). Of course you can add more.
    The list of Oracle Type Number is available here : http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements001.htm#i54330
    Starting with 11g (not sure which release), DBMS_SQL package also declares these numbers through named constants.
    <li> I don't use DBMS_XMLGEN in this example. Instead I rebuild the query using SQL/XML functions and the list of columns that's just been described.

  • How I can return the replication groups to be in the normal state again?

    Hi All,
    can anybody help me on the following issue:
    after executing "*exec dbms_repcat.suspend_master_activity(gname=>'RG_EARMS');*"
    I got the following and it rejected to resume the replication again:
    SQL>select job, what from dba_jobs where what like '%do_deferred_repcat_admin%' ;
    JOB WHAT
    31 dbms_repcat.do_deferred_repcat_admin('"RG_ELEDGER"', FALSE);
    34 dbms_repcat.do_deferred_repcat_admin('"RG_ETBR2"', FALSE);
    4 dbms_repcat.do_deferred_repcat_admin('"RG_COMMON_PROCS"', FALSE);
    55 dbms_repcat.do_deferred_repcat_admin('"RG_EFAST"', FALSE);
    7 dbms_repcat.do_deferred_repcat_admin('"RG_EFX"', FALSE);
    35 dbms_repcat.do_deferred_repcat_admin('"RG_ESTS"', FALSE);
    9 dbms_repcat.do_deferred_repcat_admin('"RG_ESCHEDULES"', FALSE);
    75 dbms_repcat.do_deferred_repcat_admin('"RG_EARMSG"', FALSE);
    32 dbms_repcat.do_deferred_repcat_admin('"RG_CSIUSER"', FALSE);
    155 dbms_repcat.do_deferred_repcat_admin('"RG_ETOOLS"', FALSE);
    10 rows selected.
    SQL>
    select gname, status from dba_repgroup;
    SQL>
    GNAME STATUS
    RG_ETBR2 NORMAL
    RG_COMMON_PROCS NORMAL
    RG_EFAST NORMAL
    RG_EARMS              QUIESCING
    RG_EFX NORMAL
    RG_ESTS NORMAL
    RG_ESCHEDULES NORMAL
    RG_EARMSG            QUIESCING
    RG_ELEDGER NORMAL
    RG_CSIUSER NORMAL
    RG_ETOOLS NORMAL
    11 rows selected.
    SQL> select id, gname, status, master, source, oname, request
    from dba_repcatlog
    order by gname, id;
    no rows selected
    the database version is 9.2.0.8.0
    the OS is SunSolaris 9
    so, how I can return the above groups to be in the normal state again?
    Thanks and Best Regards,
    Shereif
    Edited by: user642590 on Aug 6, 2009 8:13 PM

    I don't see an "dbms_repcat.do_deferred_repcat_admin('"RG_EARMS"') job.
    The RepGroup would be quiescing but not quiesced if there are active, uncomitted transactions.
    What is the error you get when you attempt to resume -- I guess that the groups are in the queiscing state ?

  • How to convert Smart Form into PDF format and return the result in BAPI?

    I want to convert a Smart Form into PDF format and return the result in BAPI.
    can anyone tell me how it can be done with related example
    regards
    pranay

    hi,
    smart form to pdf--
    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
    DATA: p_output_options TYPE ssfcompop,
    p_control_parameters TYPE ssfctrlop.
    p_control_parameters-no_dialog = 'X'.
    p_control_parameters-getotf = 'X'.
    CALL FUNCTION v_func_name "call your smartform
    EXPORTING
    output_options = p_output_options
    control_parameters = p_control_parameters
    IMPORTING
    job_output_info = s_job_output_info.
    call function 'CONVERT_OTF_2_PDF'
    tables
    otf = s_job_output_info-otfdata
    lines = t_pdf
    and if u need more u can check below links also
    Check the below links..
    Re: Smartforms to PDF
    Re: smartform (otf) as pdf and sending as email-attachment
    VISIT THIS LINK
    Re: Smartforms to PDF
    PLZ REWARD POINTS IF IT HELPS YOU
    rgds
    anver

  • The same selection doesn't return the same result in 2 identical systems

    Hi,
    After a copy we have 2 systems with same data.
    In a program the same selection doesn't returns the same result, it seems that the sort is different.
    I have checked indexes but they are ok in both systems.
    Here is the selection:
    SELECT but000~partner
    INTO TABLE lt_partner
    *UP TO 50 ROWS
    FROM but000
    JOIN but020
      ON but020partner = but000partner
    JOIN adrc
      ON adrcaddrnumber = but020addrnumber
    JOIN but100
      ON but100partner = but000partner
      WHERE but020~addr_valid_from LE '20100727000000'
      AND   but020~addr_valid_to   GE '20100727000000'.
    Is there a customizing point to define how the database must be sorted ?
    Thanks.
    Edited by: julien schneerberger on Jul 27, 2010 4:18 PM

    Hi,
    Thank you for your answer.
    Result is the same and I don't sort data after the selection.
    Do you think the system copy has "broke" the records order in database ?
    If it is the case it will be impossible to reproduce the same sort, is it right ?
    Edited by: julien schneerberger on Jul 27, 2010 5:19 PM
    Edited by: julien schneerberger on Jul 27, 2010 5:20 PM

  • How can show the result of a measuring that is done in a sub-program in my main panel?

    How can show the result of a measuring that is done in a sub-program in my main panel?

    In your subvi, wire the result(s) you want to ouput to the main program to an output terminal on the connector pane.
    For a tutorial on subvi's, search the help for "connector panes" anc click on tutorial.
    ~Tim

  • Hi there, I have much files saved on pages ( ios ipad) , I just open it today and did not find .all the files !!!! Just 4!!! Taken in consider that I did not delete or making any wrong action. How I can return the lost files!!!! Help please

    Hi there, I have much files saved on pages ( ios ipad) , I just open it today and did not find .all the files !!!! Just 4!!! Taken in consider that I did not delete or making any wrong action. How I can return the lost files!!!! Help please
    its very important files!

    tis true
    I know, I always do that but I was in a rush to get somewhere and I was relying on my thousand dollar Mac to do some kind of recovery or something. I know Microsoft always keeps temporary files (I think Mac does too, part of me asking here in this forum was for someone to tell me where I can find those files) and when you go to open Office Works then it gives you the option of opening the last recent documents, saved or not saved.
    I usually copy paste into my emial just in case something goes wrong with the created document but I just didn't have the time to login and do all that My loss, you live and you learn, BUT still if ANYONE got any info on this, PLEASE DO CHIME IN *keeping the hope alive*

  • Howto create 'select statement' that returns first row? (simple table)

    quick question that drives me crazy:
    Say I have the following table:
    ID....car_model....point_A....total
    1........333.............NY..........54
    2........333.............NJ..........42
    3........333.............NH...........63
    4........555.............NJ...........34
    5........555.............PA...........55
    I would like to create a select statement that return car_model which the starting point is NJ - in this example it's only 555.
    thanks for any tips

    fair enough.
    the problem is this: given the table below, I need to create a report that reflects car rentals from specific location. you can rent a car from different locations; a car has a starting point (like a flight itinerary) so consider this:
    Mark rent a car with the following itinerary:
    NY--> NJ
    NJ--> PA
    PA-->FL
    FL-->LA
    the end user would like to see all car that were rented between X and Y and start point was NJ, so in the example above, the starting point is NY so it doesn't match the end users' criteria.
    The table is organized in the following manner: ID....car_model....point_A....total
    * I don't know whey the someone choose point_A as a column description as it just suppose to be 'location'
    so, back to my first example:
    ID....car_model....point_A....total
    1........333.............NY..........54
    2........333.............NJ..........42
    3........333.............NH...........63
    4........555.............NJ...........34
    5........555.............PA...........55
    if I do this:
    Select car_model from myTable where point_A='NJ'
    the return result will be 333 and 555 but that is in correct because 333 starting point is NY.
    I hope I provided enough information, thanks

  • 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

  • Returning the result of a database query to a client

    glassfish
    JAX-WS 2.0
    NetBeans 5.5
    Is it possible to send a CachedRowSet object to a client?
    I get an error when i try to do so. (I can't deploy the web service method that returns the CachedRowSet)
    Is there a better way to return the result of database query to a client?
    I'd appreciate any suggestions or sample code.

    Hi!
    The result of this query will be the max ID of users' IDs.
    Let say we have:
    String sql="select max(users.id) from users";
    Statement st = ctx.conn.createStatement();
    ResultSet rs = st.executeQuery(sql);
    rs.next();     
    So you can get the max Id in the following way:     
    int maxId=rs.getInt("id");
    Regards,
    Rossi

  • Bind Variable in SELECT statement and get the value  in PL/SQL block

    Hi All,
    I would like  pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
    Please seee below
    I want to get the below value
    Expected result:
    select  distinct empno ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    100, HR
    select  distinct ename ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    TEST, HR
    select  distinct loc ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    NYC, HR
    Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
    Please suggest
    ----- TABLE LIST
    CREATE TABLE EMP(
    EMPNO NUMBER,
    ENAME VARCHAR2(255),
    DEPT VARCHAR2(255),
    LOC    VARCHAR2(255)
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
    COMMIT;
    CREATE TABLE COLUMNAMES(
    COLUMNAME VARCHAR2(255)
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
    COMMIT;
    CREATE TABLE DEPT(
    DEPT VARCHAR2(255),
    DNAME VARCHAR2(255)
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    COMMIT;
    PL/SQL BLOCK
    DECLARE
      TYPE EMPCurTyp  IS REF CURSOR;
      v_EMP_cursor    EMPCurTyp;
      l_col_val           EMP.ENAME%type;
      l_ENAME_val       EMP.ENAME%type;
    l_col_ddl varchar2(4000);
    l_col_name varchar2(60);
    l_tab_name varchar2(60);
    l_empno number ;
    b_l_col_name VARCHAR2(255);
    b_l_empno NUMBER;
    begin
    for rec00 in (
    select EMPNO aa from  EMP
    loop
    l_empno := rec00.aa;
    for rec in (select COLUMNAME as column_name  from  columnames
    loop
    l_col_name := rec.column_name;
    begin
      l_col_val :=null;
       l_col_ddl := 'select  distinct :b_l_col_name ,pr.dept ' ||'  from emp pr, dept ps where   ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
       dbms_output.put_line('DDL ...'||l_col_ddl);
       OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
    LOOP
        l_col_val :=null;
        FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
        EXIT WHEN v_EMP_cursor%NOTFOUND;
          dbms_output.put_line('l_col_name='||l_col_name ||'  empno ='||l_empno);
       END LOOP;
    CLOSE v_EMP_cursor;
    END;
    END LOOP;
    END LOOP;
    END;

    user1758353 wrote:
    Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
    As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
    However, the data structures are just that - structured. Logical.
    Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
    There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model.

  • How a select statement generates redo logs

    Can some one explain how a select statement generates redo logs
    Naveen

    Redo with a select statement happens when dirty blocks get written to the database, and are then "cleaned up" when next read of that data block. This could happen when a large DML statement does not commit before the DB Writer needs to write modified blocks to disk. The next time the blocks are read by a select statement they get modified, hence REDO is generated by the select statement.
    Read the following for more and better understandings.
    http://www.dbspecialists.com/specialists/specialist2003-10.htm
    Jaffar

Maybe you are looking for

  • Payment terms in vendor  Master

    Hi, In XK01- create vendor master, There are two payment terms--> payment transaction field and other in purchasing organisation data. Is there a configuration which will default the payment terms in purchasing org screen based on the inputs in the c

  • Mac Book Pro  doesn't like my iTunes choices? HD Spinning out of sync

    Started my iTunes library and have been loading in over 100+ CD's. Now I have a very loud constand whirring sound, comming from the area just below the power button. If I put pressure on and around the power button compressing the whirring disc, the 

  • Cant Update iSupplier Bank details after approved,need to modify account no

    I created the bank details in iSupplier and approved it. Now While trying to update the bank account number, in update page the field is not editable. The only fields that are editable are End dates and Bank Account Name. Is there a way i can make Ac

  • How can i find my families iphones

    Hi, We are an apple family.  We have several iphones and ipad's and mac's.  I have a main appleid that i use for purchases on the app store and my wife has a seperate appleid for her itunes purchases.  The problem i have is i want to be able to find

  • Creating A Header In Microsoft Word

    Hey All, I have Microsoft Word 2008 for my Mac. I just had a quick question. I'm wanting to have, in the upper right hand corner of my document, my last name and page numbers. I tried creating my own header, but that jacked up the spacing on the firs