How to generate the tag xml from oracle pl/sql

Hi all

I have my db is version 10.2.0.3.0 - Production

I tried a few examples

The first is xmlgen.getXml like that

SELECT dbms.xmlgen.getXml)
' SELECT order_number "EMP_NO".
, header_id 'NAME '.
, org_id "DEPT_NO.
Of oe_order_headers_all
WHERE header_id = 39441'
) OF THE double;


but I think xmlgen.getXm is not a valid identifier

Secondly, I tried like this

SELECT e.employee_id,
XMLELEMENT ("Emp", e.first_name |) » '|| Select) AS 'RESULT '.
OF e hr.employees



but the expected production is like that

1001 < Emp > John 6000 < / Emp >


but I'm getting

10 (ORAXML)

Someone could tell me what error or no matter what format was changed

Thanks and greetings
Srikkanth

example:

SQL> ed
Wrote file afiedt.buf

  1  SELECT dbms_xmlgen.getXml(
  2  'SELECT empno "EMP_NO"
  3  , ename "NAME"
  4  , deptno "DEPT_NO"
  5  FROM emp'
  6* ) FROM dual
SQL> /

DBMS_XMLGEN.GETXML('SELECTEMPNO"EMP_NO",ENAME"NAME",DEPTNO"DEPT_NO"FROMEMP')
--------------------------------------------------------------------------------


 
  7369
  SMITH
  20
 
 
  7499
  ALLEN
  30
 
 
  7521
  WARD
  30
 
 
  7566
  JONES
  20
 
 
  7654
  MARTIN
  30
 
 
  7698
  BLAKE
  30
 
 
  7782
  CLARK
  10
 
 
  7788
  SCOTT
  20
 
 
  7839
  KING
  10
 
 
  7844
  TURNER
  30
 
 
  7876
  ADAMS
  20
 
 
  7900
  JAMES
  30
 
 
  7902
  FORD
  20
 
 
  7934
  MILLER
  10
 

Tags: Database

Similar Questions

  • How to generate the alphanumeric sequence under oracle

    Hi Experts,

    I need to create a primary key as below,

    Its should start from a001, a002... a100 after reaching 100 the next value in the sequence must begin by b001... b100, like wise the sequence should go through until summer z001 alphabet... z100.

    Please let me know for any information.

    Kind regards

    Millar

    This will generate the a1 - a100, b1 - b100,... z1 - z100, aa1 - aa100, ab1 - ab100,... az1 - az100,...

    SEQUENCE of s FALL

    /

    CREATE SEQUENCE s

    /

    CREATE OR REPLACE

    FUNCTION get_s_nextval

    RETURN VARCHAR2

    IS

    number of v_nextval;

    number of v_alpha;

    number of v_number;

    v_base26 varchar2 (100);

    BEGIN

    v_nextval: = s.nextval;

    v_number: = MOD(v_nextval,100) CASE

    WHEN 0 THEN 100

    Of OTHER MOD(v_nextval,100)

    END;

    v_alpha: = CEIL(v_nextval / 100) - 1;

    v_base26: = NULL;

    LOOP

    v_base26: = CHR (ASCII ('a') + MOD(v_alpha,26)) | v_base26;

    EXIT WHEN v_alpha<>

    v_alpha: = TRUNC(v_alpha / 26) - 1;

    END LOOP;

    RETURN v_base26 | LPAD (v_number, 3, '0');

    END;

    /

    WITH t AS)

    SELECT s get_s_nextval,

    level lvl

    OF the double

    CONNECT BY level<=>

    )

    SELECT s

    T

    WHERE MOD(lvl,100)<=>

    ORDER BY lvl

    /

    S
    ------------------
    A001
    A100
    B001
    B100
    C001
    C100
    D001
    D100
    E001
    E100
    F001

    S
    ------------------
    F100
    G001
    G100
    H001
    H100
    I001
    i100
    J001
    J100

    20 selected lines.

    SQL >

    SY.

  • Ongoing replication of the selected tables from Oracle to SQL Server

    Hi all

    How can we replicate selected tables to Oracle 11 g for SQL Server 2008/2012?

    Is GoldenGate the only option

    No matter who did it before or have the steps to do it?

    Thank you

    Define "replicate".

    If you have no budget, you can open a connection directly from SQL Server to Oracle, or vice versa. In Oracle, they are called links DB; in SQL Server, they are called "linked servers".

    Datanamic also have tools that claim to do the cross-DB replication. I have no experience with them and is not an endorsement - I know they exist.

  • How to generate the following XML

    Hi all

    I have 2 tables, demo_orders and demo_order_items (child)
    How can I generate something like this:
    <?xml version="1.0"?>
    <ROWSET>
     <ROW>
      <ORDER_ID>1</ORDER_ID>
      <CUSTOMER_ID>1</CUSTOMER_ID>
      <ORDER_TOTAL>1200</ORDER_TOTAL>
      <ORDER_TIMESTAMP>2009-01-16T16:20:09.000</ORDER_TIMESTAMP>
      <USER_ID>2</USER_ID>
      <ITEMS>
       <ITEMROW>
        <ORDER_ITEM_ID>1</ORDER_ITEM_ID>
        <ORDER_ID>1</ORDER_ID>
        <PRODUCT_ID>1</PRODUCT_ID>
        <UNIT_PRICE>1200</UNIT_PRICE>
        <QUANTITY>1</QUANTITY>
       </ITEMROW>
      </ITEMS>
     </ROW>
     <ROW>
      <ORDER_ID>2</ORDER_ID>
      <CUSTOMER_ID>2</CUSTOMER_ID>
      <ORDER_TOTAL>599</ORDER_TOTAL>
      <ORDER_TIMESTAMP>2009-01-11T16:20:09.000</ORDER_TIMESTAMP>
      <USER_ID>2</USER_ID>
      <ITEMS>
       <ITEMROW>
        <ORDER_ITEM_ID>2</ORDER_ITEM_ID>
        <ORDER_ID>2</ORDER_ID>
        <PRODUCT_ID>2</PRODUCT_ID>
        <UNIT_PRICE>199</UNIT_PRICE>
        <QUANTITY>1</QUANTITY>
       </ITEMROW>
       <ITEMROW>
        <ORDER_ITEM_ID>3</ORDER_ITEM_ID>
        <ORDER_ID>2</ORDER_ID>
        <PRODUCT_ID>8</PRODUCT_ID>
        <UNIT_PRICE>50</UNIT_PRICE>
        <QUANTITY>2</QUANTITY>
       </ITEMROW>
      </ITEMS>
     </ROW>
    </ROWSET>

    Hi, I am assuming that the columns of the table have the same names as the xml elements in your example.

    Try this:

    SQL >select xmlelement("ROWSET",
      2                    xmlagg(xmlelement("ROW",xmlforest(order_id,
      3                                                      customer_id,
      4                                                      order_total,
      5                                                      to_char(order_timestamp,'yyyy-mm-dd"T"hh24:mi:ss.FF3') as "ORDER_TIMESTAMP",
      6                                                      user_id),
      7                                            xmlelement("ITEMS",(select
      8                                                               xmlagg(xmlelement("ITEMROW",xmlforest(order_item_id,
      9                                                                                                     order_id,
     10                                                                                                     product_id,
     11                                                                                                     unit_price,
     12                                                                                                     quantity)
     13                                                                                )
     14                                                                     ) from demo_order_items i where i.order_id=o.order_id)
     15                                                       )
     16                                     )
     17                          )
     18                   ).extract('/*') as yourXML
     19    from demo_orders o;  
    
    YOURXML
    --------------------------------------------------------------------------------------------------------------
    
      
        1
        1
        1200
        2009-12-28T10:19:01.464
        2
        
          
            1
            1
            1
            1200
            1
          
        
      
      
        2
        2
        599
        2009-12-28T10:19:01.464
        2
        
          
            2
            2
            2
            199
            1
          
          
            3
            2
            8
            50
            2
          
        
      
    
    

    The extract('/*') method is useful enough formatted output. Remove in your production applications to improve performance and space-saving.

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2009/12/27/inviare-email-dal-db-utilizzando-utl_smtp/]

  • How to access the web service from Oracle?

    Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0

    I'm making a call to a web service through a procedure/function...

    I tried to use
    CREATE OR REPLACE PROCEDURE Call_Rest_Webservice
    
     AS
    
      t_Http_Req Utl_Http.Req;
    
      t_Http_Resp Utl_Http.Resp;
    
      t_Request_Body VARCHAR2(30000);
    
      t_Respond VARCHAR2(30000);
    
      t_Start_Pos INTEGER := 1;
    
      t_Output VARCHAR2(2000);
    
    BEGIN
    
      /*Construct the information you want to send to the webservice.
      
      Normally this would be in a xml structure. But for a REST-
      
      webservice this is not mandatory. The webservice i needed to
      
      call excepts plain test.*/
    
      t_Request_Body := 'the data you want to send to the webservice';
    
      /*Telling Oracle where the webservice can be found, what kind of request is made
      
      and the version of the HTTP*/
    
      t_Http_Req := Utl_Http.Begin_Request('**webservice address**',
                                           'GET',
                                           'HTTP/1.1');
    
      /*In my case the webservice used authentication with a username an password
      
      that was provided to me. You can skip this line if it's a public webservice.*/
    
      --Utl_Http.Set_Authentication(t_Http_Req, 'username', 'password');
    
      /*Describe in the request-header what kind of data is send*/
    
      Utl_Http.Set_Header(t_Http_Req, 'Content-Type', 'text/xml charset=UTF-8');
    
      /*Describe in the request-header the lengt of the data*/
    
      Utl_Http.Set_Header(t_Http_Req, 'Content-Length', Length(t_Request_Body));
    
      /*Put the data in de body of the request*/
    
      Utl_Http.Write_Text(t_Http_Req, t_Request_Body);
    
      /*make the actual request to the webservice en catch the responce in a
      
      variable*/
    
      t_Http_Resp := Utl_Http.Get_Response(t_Http_Req);
    
      /*Read the body of the response, so you can find out if the information was
      
        received ok by the webservice.
      
        Go to the documentation of the webservice for what kind of responce you
      
        should expect. In my case it was:
      
        <responce>
      
          <status>ok</status>
      
        </responce>
      
      */
    
      Utl_Http.Read_Text(t_Http_Resp, t_Respond);
    
      /*Some closing?1 Releasing some memory, i think....*/
    
      Utl_Http.End_Response(t_Http_Resp);
    
    END;
    But it's me ORA-29272: HTTP request failed
    ORA-06512: at "SYS." UTL_HTTP", line 1029
    ORA-12545: Connect failed because target host or object does not exist

    But I can connect to the web server by going on * webservice address * through my browser.

    Is there an ACL must be open in order to have this capacity? I asked my s/n, but she asked me that I will need to give its name to username/password / ip in order to open an ACL...
    However there is no name to username/password required during a tour of the web service...

    Any help would be much appreciated...

    Thank you

    Published by: 986006 on March 4, 2013 08:38

    Y.L wrote:

    This is because the database could not connect to the specified server. Bad host name or IP address specified. Inability to resolve the hostname to an IP address. Firewall blocking. Etc.

    The host name, I put here can be visit through my browser. I think that it is not question of the host server... So, it could be a firewall on my side of the database which must be opened in order to visit the host?

    The "web browser" (your PL/SQL using UTL_HTTP code) code is running on the Oracle database server. He needs the same type of network access that has your browser on your PC. (firewalls open, authentication of the proxy if necessary, etc.).

    On 11g. Not on 10g.

    I saw the code example you post from the link you provided... those who only works on 11 g?
    If we can work on 10g, which package or what are the steps I need to follow in order to have that works on me?

    The code I posted works on both versions. My comment was regards the ACLs. No ACLs exist on 10g. If you only need to execute privs on the affected packages (e.g., UTL_HTTP, etc.).

    ACL were introduced with 11g - 11g, you also need the ADMINISTRATOR to create an ACL for you which will allow access to the UTL_HTTP network so now.

  • How to retrieve the image BLOB from database and display the image in rtf file using the Oracle XML Desktop 5.6.2 publication server?

    Hi all

    Here I have the image BLOB in the database files,

    I want to show the image to PDF using file to rtf using Oracle Xml Desktop Publisher,

    Hi all

    I found the solution for reading Image BLOB of data base & display in Pdf format.

    (1) read the image from DB.2) and then copy the picture using IO. UtilsCopy method to copy the picture

    (3) then encode with base64 converter then you will get the tag XML with Base64 as string then placed in your XML Code & preview the output, you will find the image

    Photo = (BlobDomain) currentRow.getAttribute ("Image");

    ByteArrayOutputStream OutputStream = new ByteArrayOutputStream();

                        Byte [] imageByte;
                          Byte [] b = null;
                        try {}
                        
                            IOUtils.copy (photo.getInputStream (), outputStream);
                            BS = outputStream.toByteArray ();
                            outputStream.flush ();
                            System.out.println("==="+BS.) Length);
                            Encoded byte [] is Base64.encodeBase64 (bs).;
                            encodedString = new String (encoded);
  • How to remove the menu by default oracle froms 6i

    How to remove the default window menu Oracle forms 6i.

    Amatu Allah Neveen Ebrahim wrote:

    As Salamu Asalam we Rahmatu Allah we Barakatu,.

    How are Hamid, you?

    The OP wondered about: form Menu of the window no.

    Best Regatds,

    Amatu Allah.

    Walikum As Salam O Rahmatillahi we Barakatu, sister Amatu Allah.

    Alhumdolilah. How about you?

    Average don't want to see window menu name?

    Oh, so that's that.

    1. quastion in THE HOW TO REMOVE MENU 'WINDOW' of ORACLE FORMS

    Hamid

  • How to generate the array Diagnostic Utility ADU for Esxi server

    How to run Diagnostic Utility ADU or HP Insight Diagnostics HP Insight Diagnostics table to collect the status tables and logs data FRO an Esxi Server

    How to generate the array Diagnostic Utility ADU for Esxi server

    Example:

    Download the package .vib here: http://vibsdepot.hp.com/hpq/feb2013/esxi-5x-vibs/hpacucli/hpacucli-9.40-12.0.vib

    and place it on a store of data seen by the host...

    Install it using the CLI:

    software esxcli vib install d vmfs/volumes //hpacucli-9.40-12.0.vib

    Now run it:

    ~ # cd/opt/hp/hpacucli/bin

    / opt/HP/hpacucli/bin # . / hpacucli

    HP Array Configuration Utility CLI 9.40.12.0

    Detection of controllers... Fact.

    Type 'help' for a list of supported commands.

    Type "exit" to close the console.

    => ctrl all diag file=/tmp/my_ADUreport.zip ris = on = on zip xml = on

    Generation of diagnostic report... done

    -Online output

    / opt/HP/hpacucli/bin #.

    my_ADUreport.zip in / tmp can now be downloaded from the host...

    It could be that useful...

    / Rubeck

  • How to generate the ddl for unlimited quota

    Hi all

    DB: Oracle 9.2.0.4
    OS: Solaris 8

    I have a 12 tablespaces and 18 users of the application.
    I would like to grant an unlimited quota for all users on all areas of storage, to find out how to generate the ddl script.

    ex: change the dataagent user quota unlimited on DSOM.

    can anyone help us.
    Thank you
    KK.

    All users in all areas of storage?

    Select "edit user" | user name | "quota unlimited on | nom_tablespace | ';'
    from dba_users cross join dba_tablespaces
    When not in dba_tablespaces.tablespace_name ('SYSTEM', "SYSAUX");

    Please, be careful with this

    HTH
    Antonio NAVARRO

  • How to remove the extra space of oracle database column

    How to remove the extra space of oracle database column. I would like to clean up the column in the database by deleting the extra space is entered by the dataentery people.

    When I run the query:
    SELECT
    ROWID, C.CODETABLE_ID, C.CODEVALUE_ID, C.DESCR, LENGTH (C.CODEVALUE_ID).
    C.OBSOLETE_DT, C.RECORDSOURCE, C.CREATED_DT,
    C.CREATEDBY, C.LASTUPDATED_DT, C.LASTUPDATEDBY
    OF CODEVALUE C
    Where LENGTH (C.CODEVALUE_ID) > 6

    the data type is varchar2 and I would get rid of the any extra blank space added to the column. in my case, if the length is greater than 6

    Hello

    user452051 wrote:
    Thanks for the reply. Why should I have this line?

    AND codevlaue_id! = TRIM (codevalue_id) - see note below
    ;

    I just changed my post when you posted this. The explanation is there now:

    Frank Kulash wrote:
    ...
    The condition "codevlaue_id!" = TRIM (codevalue_id)"does not change the results of everything, but it can make the most effective statement if there are lines where codevalue_id is on 6 characters long, but contains no additional space. It will prevent the triggers from firing and redo the data generated.

  • How to generate the script to insert data tables present in a

    How to generate the script to insert data from one table in an entire schema under environment sqlplus




    with toads it please help me please!

    905310 wrote:
    How to generate the script to insert data from one table in an entire schema under environment sqlplus
    with toads it please help me please!

    The correct method by using the pump of the database or import/export or unload the data in CSV format for loading using SQL * Loader.

    Generate instructions insert with literals is very bad choices - the bind variable is missing. It will be quite slow because many other CPU cycles are spend on hard analysis. The shared pool will become fragmented. This can cause errors of memory for other applications when they attempt to analyze SQLs for cursors.

  • How to generate the WSDL in CCB231

    How to generate the WSDL in ccb231? I'm not able to use the WSDL generated to XAI inbound service like soapUI gives importing problem. I couldn't open the schema editor to generate the WSDL as ODBC driver is missing from my windows machine 7. Any suggestions please

    What kind of import errors that you get with soapUI?

    I have a virtual machine running CC & B 2.3.1 with SoapUI 3.6.1 and when I import the WSDL generated by XAI Inbound Service it runs smoothly.

  • How edit you the Tags in 11 elements

    Hi Forum

    I use 11 items and can't see how to edit the Tags in the Organizer

    Concerning

    David

    Ohkk... I get that now...

    If you try to change the tags people use in the right panel in the media view. Yes, she does not edit here.

    All of the associated People tags editing is limited to view only people.

    Since the places and events tags form previous versions are not immediately mapped to the view of places and PSE11 events, their treatment had no change. They are treated as tags only. But for people tags, their corresponding people stacks are worked, to give you a clean organization by people in sight.

    So to answer your question, edit the label of people work exclusively in view people... Through the operation "Rename" from the context menu.

    Thank you

    Catherine

  • How to disconnect the access code from my iPad 2

    How to disconnect the access code from my iPad 2

    What do you mean by "disconnect"? If you mean stop using an access code then settings > password (enter your current password) > disable password

  • How to remove the effect - brightness, from there?

    How to remove the effect - brightness, from there.  First of all I thought to increase the sound volume using the BRIGHTNESS of the effect, but now improved Audio, I use the volume, which is enough.

    So I would remove the block of brightness from there.

    Thank you.

    The brightness setting should not have any effect as you turned it off.  .  .  the blue square is not lit.

    However, if you don't like the look of it sitting there, highlight as I did it and press the DELETE (backspace) key to make them disappear.

Maybe you are looking for