VIEW XML IN SQL*PLUS

how can we view xml on sql*plus?
when xmltype is viewed on sql*prompt it shows incomplete xml.
example:
SQL> select xmlelement("ROOT",xmlforest(1 as A, 2 as B, 3 as C)) from dual;
XMLELEMENT("ROOT",XMLFOREST(1ASA,2ASB,3ASC))
<ROOT>
<A>1</A>
<B>2</B>
<C>3</C>
</ROOT>
but i generate an xml from table so it becomes quite huge. say a forest is populated with 6-8 tags. it shows broken output.
SQL> /
ID LIST
<DEPT>
<EMPLOYEE>
<ID>2109</ID>
<ID>3108</ID>
<ID>4107</ID>
<ID>5106</ID>
<ID
i have tried increasing bufferwidth and bufferlength tp max value (1000 and 2000 respectively) eventhen it displays the output as shown above.
how can i view my xml?

use this sql plus command:
set long 2000000
You can increase\decrease the value as required.

Similar Messages

  • Need to find out View definition by SQL PLUS

    Hi,
    I have a view VW_XXX, I want to know by which table this view has created. But need to use only SQL PLUS not any tool.
    Please let me know how cani see the full definitio of the view by SQL PLUS.
    Regs,
    brij

    Yes, it will work for both 9i and 10g. Just run the commands, and you will get the output.
    These are not "Dangerous Commands!!!"
    Regards
    Girish Sharma
    Edited by: Girish Sharma on Dec 26, 2011 5:19 PM
    To solve these issues Oracle9i has introduced the DBMS_METADATA package which can be used to retrieve object definitions as DDL or XML. There are a number of ways to use the API, but I suspect the majority of people will only ever use the following functions.
    Source:http://www.oracle-base.com/articles/9i/MetadataAPI.php
    Edited by: Girish Sharma on Dec 26, 2011 5:36 PM
    And here it is doc link :
    http://docs.oracle.com/cd/A91202_01/901_doc/appdev.901/a89852/d_meta11.htm#1024701

  • Apex 4.0 - Can see view data in SQL*Plus but no data in Object Browser

    Hi There,
    I have just started using Apex 4.o and migrated some apps. I have an issue with a report, but see the same issue with Object browser, which is easier to describe.
    I have a view:
    create or replace view V_PLJ_USERDEF_CODES (
             CODE_SET_ID,
             CODE_SET_CODE,
             CODE_SET_DESC,
             CODE_ID,
             CODE_SYS_CODE,
             CODE_VALUE,
             CODE_DESC,
             DISPLAY_SEQ,
             DISPLAY_FLAG,
             LANGUAGE_CODE) as
      select CS.CODE_SET_ID,
             CS.CODE_SET_CODE,
             CS.CODE_SET_DESC,
             C.CODE_ID,
             C.CODE_SYS_CODE,
             C.CODE_VALUE,
             C.CODE_DESC,
             C.DISPLAY_SEQ,
             C.DISPLAY_FLAG,
             C.LANGUAGE_CODE
        from PLJ_CODES C,
             PLJ_CODE_SETS CS
       where C.CODE_SET_ID         = CS.CODE_SET_ID
         and CS.CODE_SET_TYPE_CODE = SYS_CONTEXT('PLJUMPSTART','C_USERDEF_CODE_SET');This returns data in SQL*Plus, but no data in Object Browser OR report region based on this view.
    Workspace parses in the same schema as tested in SQL*Plus.
    If, in report, I swap out view, and use underlying table - no problem.
    Any ideas -
    thanks
    P

    Hi all,
    Thanks for getting back so promptly.
    It just seems weird to me, as tables are just fine, but not views.
    In the underlying schema:
    SQL> sho user
    USER is "ICSREPORTING"
    SQL> select count(*) from plj_codes;
      COUNT(*)
           107
    SQL> select count(*) from v_plj_userdef_codes;
      COUNT(*)
            29And in the APEX schema
    SQL> sho user
    USER is "APEX_040000"
    SQL> select count(*) from icsreporting.plj_codes;
    select count(*) from icsreporting.plj_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> select count(*) from icsreporting.v_plj_userdef_codes;
    select count(*) from icsreporting.v_plj_userdef_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL>However, in SQL browser, I can see the data in PLJ_CODES but in V_PLJ_USERDEF_CODES, just the message "This view has no data". Indeed, it is like this for all views.
    I even explicitly granted access to APEX_040000 but no good.
    In fact, I would like to know more about how Apex gets access to do DML against the underlying parsing schema(s).
    This is a little frustrating though. It worked just fine in lots of apps in version 2.1 to 3.2
    Am I missing something
    paul
    p.s I knew there would be a question about the context, but I had already checked that. :)
    Edited by: PJ on Nov 19, 2010 4:09 AM

  • Viewing tables in sql plus

    hai friends.,
    i created a java database pgm using jdbc:odbc connectivity, that creates a table in the database and i inserted some records in that table. how can i view those table and records in the sql plus. what commands are used to view those table
    regards.,
    sekar

    Hi sekar,
    Interesting, you're able to do a 'CREATE TABLE bla...' but are not familiar with 'SELECT'? I would suggest to read some basic stuff about SQL statements. What will you do when the next task is: "Hey, I need a pgm to change these values in the table!"?
    Regards,
    Guido

  • Issues passing XML to SQL*Plus in UNIX

    Oracle 10.2.0.3.0
    For some reason I can't seem to figure this out.
    This is my PL/SQL script (load_table.sql):
    SET SERVEROUTPUT ON
    SET VERIFY OFF
    DECLARE
      v_clob CLOB;
    BEGIN
      v_clob := '&1';
      INSERT INTO rh_page (pageid, pagecontent)
      VALUES ('&2', XMLTYPE(v_clob));
      COMMIT;
    END;
    EXIT;
    It is executed by this shell script (load_table.sh):
    #!/usr/bin/ksh
    . $HOME/envfile
    USERID=myUserID/myPassword
    XMLDATA=`cat test_file.xml`
    FILENAME="TestFile"
    LOG_FILE=load_table.log
    sqlplus $USERID << EOF > ${LOG_FILE}
    @ load_table.sql ${XMLDATA} ${FILENAME}
    exit 0
    Here is a sample of the XML:
    <?xml version="1.0" encoding="utf-8" ?>
    <Page>
            <PageName></PageName>
            <Title></Title>
            <Roles>-1</Roles>
            <Controls>
                    <PageTool>
                            <visible>false</visible>
                    </PageTool>
                    <divTopLeft>
                            <visible>true</visible>
    </Page>
    After I execute load_table.sh, I see that load_table.log contains the following error:
    SQL> SQL> DECLARE
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00007: unexpected end-of-file encountered
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-06512: at line 9Any ideas on what is causing this error or how to resolve?

    I understand this is probably not the best approach; however, I was in the process of automating the process of reading multiple XML files and loading their content to a table. Since I don't have DB privelges to set up External Tables or utilize UTL_FILE, I was trying this approach to simply direct the contents of an XML file into a UNIX shell script variable, and then pass it on as a SQL*Plus substitution variable.
    I originally did this manually, by opening each of the 40+ files and copying/pasting their content to set a CLOB variable in a PL/SQL block...now I'm just trying to figure a way to automate the same manual steps.

  • DISPLAY UNDEFINE TABLES IN SQL PLUS

    i am using Oracle 10g
    for last 1 week i seen unrecognized table names in my user while i issue following command
    SQL > select * from tab;
    table name like ......BIN$ and many other characters after it...
    i cannot drop that table also
    from DBA studio above table can't view but from SQL PLUS it display as table
    what i have to do to drop such tables ? please give advice

    These are recyclebin tables. A normal 'drop table' command puts a table into the recyclebin, you can get it back through 'flashback drop' command. Use 'purge user_recyclebin' to delete the tables finally.
    Werner

  • SQL*Plus formatting

    Can someone know how to configure login.sql to view data from SQL*Plus just like in standard MySQL output?

    as to the one column per line, I would recommend increasing your LINESIZE
    set linesize 1000
    to get the vertical bar between things
    set colsep |
    to force a row of underscores between each line
    set recsep each
    don't think we can do the "+"
    and I hope the lack of spaces (positional output) is due to the lack of "[ pre ]" tags in your post
    SQL> select * from words where rownum < 10;
    WORD                                                                   A N UPPER_WORD                             SEQ_NUM SOUN
    ARCADIAN                                                                   ARCADIAN                                     1 A623
    ARCHAEOLOGICAL                                                             ARCHAEOLOGICAL                               2 A624
    ARCHAEOLOGISTS                                                             ARCHAEOLOGISTS                               3 A624
    ARISTOTELIANS                                                              ARISTOTELIANS                                4 A623
    ARITA                                                                      ARITA                                        5 A630
    ARIZONA                                                                    ARIZONA                                      6 A625
    ARJUNA                                                                     ARJUNA                                       7 A625
    ARKANSAS                                                                   ARKANSAS                                     8 A625
    ARKWRIGHT                                                                  ARKWRIGHT                                    9 A626
    SQL>
    SQL>
    SQL> set linesize 1000
    SQL> set colsep |
    SQL> set recsep each
    SQL> /
    WORD                                                                  |A|N|UPPER_WORD                         |   SEQ_NUM|SOUN
    ----------------------------------------------------------------------|-|-|-----------------------------------|----------|----
    ARCADIAN                                                              | | |ARCADIAN                           |         1|A623
    ARCHAEOLOGICAL                                                        | | |ARCHAEOLOGICAL                     |         2|A624
    ARCHAEOLOGISTS                                                        | | |ARCHAEOLOGISTS                     |         3|A624
    ARISTOTELIANS                                                         | | |ARISTOTELIANS                      |         4|A623
    ARITA                                                                 | | |ARITA                              |         5|A630
    ARIZONA                                                               | | |ARIZONA                            |         6|A625
    ARJUNA                                                                | | |ARJUNA                             |         7|A625
    ARKANSAS                                                              | | |ARKANSAS                           |         8|A625
    ARKWRIGHT                                                             | | |ARKWRIGHT                          |         9|A626
    ------------------------------------------------------------------------------------------------------------------------------------

  • Can we use xml Publisher reporting for sql* Plus in EBS

    Hello All,
    The current report is designed in Sql* Plus Executable report and the output is in txt format, Now the requirement is to have the output in Excel format.
    So is it possible to use the xml reporting and make the output as Excel from the word template we design from MSword as we do for rdf(I have done few reports created in rdf to xml publisher reports in EBS and stand alone as well.).
    Do the same procedure will suit for Sql*Plus reports tooo or Is there any work around to achieve this.
    Thanks and Regards
    Balaji.

    Hi
    Thanks for the reply..
    I tried to do the follwoing
    1. changed the output to xml in the conc. prog.
    2. ran the same report but i am getting the follwoing error in the output file
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource
    Other reports which are using the Oracle Reports(rdf) as source, i am able to generated the xml as expected....
    So my question is whether we can use sql* reports executable and generate xml in the conc.prog.
    if any one has used the sql*reports for xml publisher reporting... please let me know, so that if its possible i will check my sql needs some validation or tuning...
    thanks in advance
    Balaji.

  • XML display in SQL*Plus

    Hi,
    I have a data stored in table in XML format in a clob column. When I query the table containing the XML data only part of the XML is shown in SQL*Plus. Is there anyway that I can view the full XML data in SQL* Plus prompt?
    Thanks,
    Milton.

    The SET LOBOFFSET, SET LONG and SET LONGCHUNKSIZE values affect how SQL*Plus fetches from CLOBs.
    See http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a90842/ch13.htm#1012674
    -- CJ

  • Error creating view with CASE -- WHEN statement in SQL*Plus

    I am using Oracle 8i 8.1.7
    I have an Oracle view which uses CASE...WHEN statements.
    The view compiles fine in DBA studio.
    Using TOAD I saved the view as an *.sql file.
    However, when I try to create the view in SQL*Plus I get the following error:
    SP2-0734: unknown command beginning "CASE WHEN ..." - rest of line ignored.
    According to the documentation CASE -- WHEN has been implemented since since Oracle 8i rel. 2 (8.1.6)

    Well I'm using 8.1.6.3 and CASE and DECODE both work for me:
    SQL> create or replace view v_accs as select account_name, txn,
    2 decode(credit, 0, 'DB', 'CR') t_type
    3 from accs;
    View created.
    SQL> select * from v_accs;
    ACCOUNT_NA TXN T_
    APC 1 DB
    ABC 2 DB
    HJJ 3 DB
    HJH 4 CR
    HJK 5 CR
    APC 6 DB
    APC 7 DB
    ABC 8 DB
    ABC 9 DB
    HJJ 10 DB
    HJJ 11 DB
    HJH 12 DB
    HJH 13 DB
    HJK 14 DB
    HJK 15 CR
    15 rows selected.
    SQL> create or replace view v_accs as select account_name, txn,
    2 case when credit = 0 then 'DB' else 'CR'end as t_type
    3* from accs
    View created.
    SQL> select * from v_accs;
    ACCOUNT_NA TXN T_
    APC 1 DB
    ABC 2 DB
    HJJ 3 DB
    HJH 4 CR
    HJK 5 CR
    APC 6 DB
    APC 7 DB
    ABC 8 DB
    ABC 9 DB
    HJJ 10 DB
    HJJ 11 DB
    HJH 12 DB
    HJH 13 DB
    HJK 14 DB
    HJK 15 CR
    15 rows selected.
    SQL>
    rgds, APC

  • Xml output format in sql*plus problem

    Hi all,
    In stead of seeing xml output in multiple line format, my sql*plus always returns xml output in ONE line, is there a way to change the format, it's really hard to read.
    Thanks
    1 select xmlelement("row", xmlelement("user", xmlattributes(username as "name", default_tablespa
    2 from dba_users
    3* where rownum=1
    SQL>/
    XMLELEMENT("ROW",XMLELEMENT("USER",XMLATTRIBUTES(USERNAMEAS"NAME",DEFAULT_TABLES
    <row><user name="SYS" tbs="SYSTEM"></user></row>
    however I want to see something well formatted like
    <row>
    <user name="SYS" tbs="SYSTEM"></user>
    </row>

    Not sure if there are any settings with the SQL*PLUS but if you use packages other than the SQLX operators like DBMS_XMLQUERY, DBMS_XMLGEN, SYS_XMLGEN to generate xml then the output is as desired.
    select dbms_xmlgen.getxml('select username, default_tablespace from dba_users
    where rownum=1') from dual
    DBMS_XMLGEN.GETXML('SELECTUSERNAME,DEFAULT_TABLESPACEFROMDBA_USERSWHEREROWNUM=1'
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <USERNAME>REVIEW</USERNAME>
    <DEFAULT_TABLESPACE>METRICS</DEFAULT_TABLESPACE>
    </ROW>
    </ROWSET>
    But these packages does not offer the flexibility you have with SQLX operators.
    so if you requirement is simple generation you can use the above method.

  • How to insert huge XML in CLOB using insert command in sql*plus....

    How to upload huge XML into a CLOB column of a normal table using a script?
    A simple insert statement does not seem to work.
    Thanks & regards.

    In SQL *Plus i'm trying to insert directly into the table.
    My insert statement is like below :
    Insert into ui_templates
    (TEMPLATE_ID, TEMPLATE_NAME, CUSTOMER_ID, DESCRIPTION, XML_CONTENT)
    Values
    (1, 'Default', 1, 'Main Default Template', '<?xml version="1.0" encoding="utf-8"?><xoraLayout:Layout name="MyLayout" version="1.0" ................<3357> chars long');
    COMMIT;
    Message was edited by:
    DKar

  • SQL * Plus to XML output

    Hi,
    I have a requirement for a report , report output should be in Excel.
    I created a sql query using user defined functions and inline query. I registered the query in concurrent program with XML output. When I run the request i'm getting the below error
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'http://opusapp1.co.pinellas.fl.us:8010/OA_CGI/FNDWRR.e...
    If the output is text then i got the output. I need the XML output, so that i can create XML template.
    Thanks for your help.

    Please post the details of the application release, database version and OS.
    Please see if (Report Output Error: The XML page cannot be displayed. Cannot view XML input using style sheet. [ID 753620.1]) helps.
    Also, see old threads for similar discussion about generating Excel output format -- http://forums.oracle.com/forums/search.jspa?threadID=&q=Excel+AND+XML+AND+Publisher&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Viewing Binary data in SQL*PLUS

    hi all,
    when i select a table to view the content, i received an error which i shown below.
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    the error seems that the binary data cannot be view thru SQL PLUS.
    do anybody have idea to solve this issue.
    thanks in advance
    karthik.J

    Probably you are trying to view BLOB data. Try this to view the data:
    SQL> CREATE TABLE t (a BLOB)
      2  /
    Table created.
    SQL> INSERT INTO t
      2       VALUES (UTL_RAW.cast_to_raw ('Hello World'))
      3  /
    1 row created.
    SQL> SELECT UTL_RAW.cast_to_varchar2 (a) a
      2    FROM t
      3  /
    A
    Hello World

  • How to view full script in sql*plus

    Hi,
    i am having a user who want to view the script for trigger by querying user_triggers in SQL*PLUS. i just remembered that there is some DBMS_ package for doing this. can anyone please provide that package name.
    thanks in advance

    Were you thinking of DBMS_METADATA?
    Have a look at this: http://blogs.ittoolbox.com/database/solutions/archives/ddl-generationoracles-answer-to-save-you-time-and-money-7590

Maybe you are looking for

  • Help, how to restore backed-up data from old 3GS to my new 3GS?

    Hi I recently got a replacement phone, and when i synced it to iTunes, the prompt to restore my backed-up data came up. However when I tried to restore, it prompted me to update my new phone's software to 3.1 first. So now, after updating my software

  • Signing a form without a signature field

    We use the certify method of the SignatureServiceClient as described in http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=000898.html Because we simply want to sign the form, we create an invisible signature field and pass th

  • Populating a load-status table from SQL*Loader

    Hello, I am using SQL*LDR to load a table and once I'm done with this load I am supposed to populate a status table which will capture the 'SYSDATE', and the total number of rows I loaded in the other table. Can anybody help me? Thanks

  • What EXACTLY uses the data?

    I have an Iphone 4S with 16gb, hubs has Iphone 4 with 8. I need to help him manage his data better cause he is almost to the 2gb limit. This resets every month right? and are the games he is playing using up his data or is it pictures and text? I hav

  • Anyone with knowledge of Clamxav as a virus cleaner for my mac pro

    Although I have repeatedly asked about whether or not to install spyware and told no need- my accounts have been compromised and I run an old computer PC in household-- anyone iwth knowledge of clamxav- will it do more harm than good