Columns to rows using PL/SQL?

Hello


With the help of Oracle 11 g R2. I have the following table:

1 1 value11

1 2 value12

1 3 value13

1 4 value14

2 1 value21

2 2 value22

2 3 value23

2 4 value24

... etc... several hundred lines

What I would like, is to transform this table to:

1 value11, value12, value13 value14

2 value21 value22 value23 value24

.. etc...

Please notify.

Kind regards

M.R.

Hello

M.R. says:

Sorry, here are the instructions to create the table and insert values:

using Oracle 11 g R2

CREATE TABLE MyTable

(

row_nr INTEGER,

col_nr INTEGER,

string_val VARCHAR2 (500)

);

INSERT INTO myTable (row_nr, col_nr, string_val)

VALUES (1, 1, value11);

...

Do one of these specifications INSERT when judge you them?  Looks like you need single quotes around all string_vals, like this:

INSERT INTO myTable (row_nr, col_nr, string_val)

VALUES (1, 1, "value11");

Since you're uisng Oracle 11.2, you can use SELECT... PIVOT, like this:

SELECT *.

FROM MyTable

PIVOT (MIN (string_val)

FOR col_nr IN (1 AS col_1

2 UNDER col_2

3 AS col_3

4 AS col_4

)

)

ORDER BY row_nr

;

Tags: Database

Similar Questions

  • inserting rows using pl sql

    Hi all

    I created a tabale to insert a number

    create the table loc_number (c1 number);

    now, I want to insert 10 lines in this table using pl sql.

    How can I do so using pl sql?

    Hello

    Yes it is possible.

    Why use loops here?

    (I guess, you need to practice this goal)

    begin
    
     for i in 1..10
     loop
    
       insert into loc_number
           values (i);
    
     end loop;
    
     commit;
    
    end;
    
  • How to convert the column of ROW using DBMS_REDIFINITION object type column

    Hi all
    Suppose I have the following table to convert:
    create table customer as select customer_id cid, cust_first_name name, cust_address street from customers;
    alter table customer modify cid primary key;
    I created the table based on the customers of the OE schema table, while the street column has cust_address_typ with the following attribute object type
    SQL> describe cust_address_typ
     Name                                     Null?     Type
     ----------------------------------------------------- -------- ------------------------------------
     STREET_ADDRESS                               VARCHAR2(40)
     POSTAL_CODE                                   VARCHAR2(10)
     CITY                                        VARCHAR2(30)
     STATE_PROVINCE                               VARCHAR2(10)
     COUNTRY_ID                                   CHAR(2)
    I want to convert the object attribute adresse_rue in a column of RDM. Consider the following temporary table:
    CREATE TABLE INT_CUSTOMER(
    CID NUMBER,
    NAME VARCHAR2(30),
    street varchar2(100)
    );
    First of all, I checked if the table can be redefined:
    --Verify if the table can be redefined
    BEGIN
    DBMS_REDEFINITION.CAN_REDEF_TABLE('OE','CUSTOMER',DBMS_REDEFINITION.CONS_USE_PK);
    END;
     4  /
    
    PL/SQL procedure successfully completed.
    But when I started the redefinition, I got an error:
    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME, STREET CUST_ADDRESS_TYP(STREET_ADDRESS)'
    );
    END;
      9  /
    BEGIN
    *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
    ORA-06512: at line 2
    What seemed to be the problem?

    Best regards
    Val

    Published by: Valerie good-natured October 9, 2011 21:43

    Have you tried this one:

    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET'
    );
    END;
    

    Looking at your trace file, I claim that when you use the call above to START_REDEF_TABLE, the inner workings of this procedure will create this SQL statement:

    select CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET from "OE"."CUSTOMER" "CUSTOMER"
    

    (You can prove or disprove my claim by tracing it ;-)))

    And this statement has had an alias - even if the alias is the same as the name of the table...

  • How to set default cell format 'text' instead of 'general' sheet in excel using pl/sql code?

    Can someone please help me on how to generate excel file using pl/sql? I have generated csv files successfully, but now I need to generate a excel. I changed the code generation of the csv file, but the file gives me error when opening:

    "The file you are trying to open,"XXXX.xls", is in a different format than specified by the file extension. Do you want to open it now? »

    If I choose Yes then open the excel file, but it excludes the leading 0 in the front for one my column. How do I configure excel type default column as text rather than General, when you create the files? I also tried to generate excel file using xml. But I do not know how to set the type of column there, too. I'm using Oracle 11.2.0.3.0 and APEX 4.2.6.00.03. I'll call all these codes apex.

    Code1 is used:

    Declare

    output_header varchar2 (4000);

    fichier_en_sortie VARCHAR2 (255);

    Varchar2 (2) EOL: = Chr (13) | Chr (10);

    BEGIN

    output_header: = 'tls_tracking_id ' | Chr (9) | ' fnn_ext' | Chr (9) | "path_id' | EOL;

    fichier_en_sortie: = 'report_excel' |'. XLS;

    owa_util.mime_header ("application/octet ', false");

    HTP.p ('Content-Disposition: attachment; filename = "" | ") fichier_en_sortie |' « ') ;

    owa_util.http_header_close;

    HTP. PRN (output_header);

    for r in)

    Select tls_tracking_id, fnn_ext, DWD_DTOV_OUT_VW path_id

    where nbn_loc_id = 'LOC000138413115. '

    The order of tls_tracking_id LOOP)

    HTP. PRN (r.tls_tracking_id

    || Chr (9) | r.fnn_ext

    || Chr (9) | r.path_id

    || EOL

    );

    END LOOP;

    END;

    Code2 used :

    create or replace PACKAGE BODY IS pkg_excel_export

    PROCEDURE excel_open (l_xml_body IN OUT NOCOPY CLOB) IS

    BEGIN

    l_xml_body: = ' <? XML version = "1.0" encoding = "ISO-8859-9"? > ' | Chr (10) |

    "< workbook xmlns =" "urn: schemas-microsoft - com:office:spreadsheet" ' | "

    Chr (10) |

    ""xmlns:o ="urn: schemas-microsoft-com ' ' |

    Chr (10) |

    "xmlns: x =" "urn: schemas-microsoft-com: excel" ' | "

    Chr (10) |

    ""xmlns:ss ="urn: schemas-microsoft - com:office:spreadsheet" ' |

    Chr (10) |

                            'xmlns:html=" http://www.w3.org/TR/REC-html40 ">' ||

    Chr (10) |

    ' < ExcelWorkbook xmlns = "urn: schemas-microsoft-com: excel" > ' |

    Chr (10) | ' < WindowHeight > 8580 < / WindowHeight > ' |

    Chr (10) | ' < WindowWidth > 15180 < / WindowWidth > ' | Chr (10) |

    ' < WindowTopX > 120 < / WindowTopX > ' | Chr (10) |

    ' < WindowTopY > 45 < / WindowTopY > ' | Chr (10) |

    ' < ProtectStructure > false < / ProtectStructure > ' | Chr (10) |

    ' < ProtectWindows > false < / ProtectWindows > ' | Chr (10) |

    ' < / ExcelWorkbook > ' | Chr (10) | "< Styles > | Chr (10) |

    '< ss:ID of style = 'Default' ss:Name 'Normal' = >' | Chr (10) |

    "< ss:Vertical alignment = 'Bottom' / >" | " Chr (10) |

    ' < borders / > '. Chr (10) | ' < police / > '. Chr (10) |

    ' < Interior / > '. Chr (10) | ' < NumberFormat / > '. Chr (10) |

    ' < protection / > '. Chr (10) | "< / style > | Chr (10) |

    '< ss:ID of style 's22' = >' | Chr (10) |

    "< x: font family = ss"Swiss":"BOLD"="1"ss:Underline ="Single"/ >" | "

    Chr (10) | "< / style > | Chr (10) | "< / style >";

    END excel_open;

    PROCEDURE excel_close (l_xml_body IN OUT NOCOPY CLOB) IS

    BEGIN

    l_xml_body: = l_xml_body | ' < / workbook > ';

    END excel_close;

    / * Opens a worksheet in the Excel file. , You can open multiple worksheets. **/

    PROCEDURE worksheet_open

    (

    l_xml_body IN OUT NOCOPY CLOB,

    p_worksheetname in VARCHAR2

    ) IS

    BEGIN

    --

    -Create the worksheet

    --

    l_xml_body: = l_xml_body | "' < worksheet ss:Name = ' ' | p_worksheetname |

    "" > < table > ";"

    END worksheet_open;

    / *Farm the worksheet in the Excel file.   **/

    PROCEDURE worksheet_close (l_xml_body IN OUT NOCOPY CLOB) IS

    BEGIN

    l_xml_body: = l_xml_body | ' < / table > < / worksheet > ';

    END worksheet_close;

    / *Opens the tag line * /

    PROCEDURE row_open (l_xml_body IN OUT NOCOPY CLOB) IS

    BEGIN

    l_xml_body: = l_xml_body | "< row >."

    END row_open;

    / *Farm the tag line * /.

    PROCEDURE row_close (l_xml_body IN OUT NOCOPY CLOB) IS

    BEGIN

    l_xml_body: = l_xml_body | "< / row > | Chr (10);

    END row_close;

    / *After the opening of the line, we can write something the first cell* /

    PROCEDURE cell_write

    (

    l_xml_body IN OUT NOCOPY CLOB,

    p_content in VARCHAR2

    ) IS

    BEGIN

    l_xml_body: = l_xml_body | ' < cell > < data ss:Type = "String" > ' |

    p_content | ' < / data > < / cell > ';

    END cell_write;

    / * If you use this package of APEX, you get to download the excel file. **/

    PROCEDURE excel_get

    (

    l_xml_body IN OUT NOCOPY CLOB,

    p_filename in VARCHAR2

    ) IS

    XX BLOB;

    make the NUMBER;

    This NUMBER;

    BC NUMBER.

    LC NUMBER;

    w NUMBER;

    BEGIN

    DBMS_LOB.CREATETEMPORARY (xx, TRUE);

    make: = 1;

    so: = 1;

    BC: = dbms_lob.default_csid;

    LC: = dbms_lob.default_lang_ctx;

    w: = dbms_lob.no_warning;

    DBMS_LOB.converttoblob (xx,

    l_xml_body,

    DBMS_LOB.lobmaxsize,

    do,

    Thus,.

    British Colombia,

    LC,

    (w);

    owa_util.mime_header ("application/octet ', FALSE");

    -set the size so that the browser knows how to download

    HTP.p ("Content-length: ' |") DBMS_LOB.GetLength (xx));

    -the name of the file will be used by the browser if users only one save as

    HTP.p ('Content-Disposition: attachment; filename = "" | ") p_filename |

    '.xls ' | '"');

    -close the headers

    owa_util.http_header_close;

    -Download the BLOB

    wpg_docload.download_file (XX);

    END excel_get;

    END pkg_excel_export;

    I know it's a bit long code, but to better understand please consider...

    Thank you.

    I did worked putting just one extra line in my l_xml_body in the XML (Code 2 used). Now my excel generates with cells type 'Text' and there are no left falling to zero. Also the columns display not scientific format as 2.3D + 12. Current recording shows without default formatting.

    '

  • Load the data from a text file into a table using pl/sql

    Hi Experts,

    I want to load the data from a text file (sample1.txt) to a table using pl/sql

    I used the pl/sql code below

    ***********************************
    declare
    f utl_file.file_type;
    s varchar2 (200);
    c number: = 0;
    Start
    f: = utl_file.fopen('TRY','sample1.txt','R');
    loop
    UTL_FILE.get_line (f, s);
    insert into sampletable (a, b, c) values (s, s, s);
    c: = c + 1;
    end loop;
    exception
    When NO_DATA_FOUND then
    UTL_FILE.fclose (f);
    dbms_output.put_line('No. deles de lignes insérées: ' || c);
    end;

    ***************************************

    and my sample1.txt file looks like

    ***************************************
    1
    2
    3
    ***************************************

    Gets the data inserted, with way below

    Select * from sampletable;

    A, B AND C

    1-1-1
    2-2-2
    3 3 3

    I want that data to get inserted as

    A, B AND C

    1 2 3

    The text file I have is to have three lines, and the first value of each line should go to each column

    Help, please...

    Thank you
    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;
    

    SY.

  • can I write in a clay column and row in excel?

    Hello!!!

    Well, is - can anyone help me and tell me, if I can write something of labview in a clay column and row in excel?

    excellent couerse in a clay column and row to an existing file...

    CAN SOMEONE HELP ME OR SAY SOMETHING PLEASE?

    Ago, as Sophia said, you can do this using ActiveX, but that requires a lot of programming

    but you can learn a lot

  • How to save the table column and row headings

    I have a table where I activated the column and row headings.  Once the table is loaded with data, I would like to save the contents of the table, including the column and row headings in a text file.  The crux of "value" property returns only the content of the table, not the row and column headers.  I could use "header line chains []" and '[] column header chains' property nodes as well, but I'm in the island there is an easier way.  Looks like adding the headers of lines would be difficult.  Any ideas?

    Thanks in advance.

    Here is a way. The construction with the empty constant is to provide to the left corner of the table where there is no data.

  • How because result of xml using PL/SQL

    Hi all.

    I got a response from the web service xml, and I must parseit using PL/SQL.

    This is my XML:

    " < s: Envelope = xmlns:s ' http://www.w3.org/2003/05/soap-envelope "" xmlns: a = " " http://www.w3.org/2005/08/addressing ">

    < s:Header >

    < a: Action = '1' s:mustUnderstand > http://tempuri.org/IPagosLineaService/ProcesarComunicacionOnlineResponse < / a: Action >

    < / s:Header >

    < Body >

    " < ProcesarComunicacionOnlineResponse xmlns =" http://tempuri.org/ ">

    " < ProcesarComunicacionOnlineResult xmlns: b = ' http://schemas.DataContract.org/2004/07/SiGe.Servicios.Sanaa "xmlns:i =" " http://www.w3.org/2001/XMLSchema-instance « >

    < b:REFGLOBAL > 201510533758 < / b:REFGLOBAL >

    < b:IMPTOTAL > 357.09 < / b:IMPTOTAL >

    < b:IMPMORA > 0 < / b:IMPMORA >

    < b:TIPOIMP > 67 < / b:TIPOIMP >

    < b:MONEDA > 76 < / b:MONEDA >

    < b:FETPAG > 2015-11-30 T 00: 00:00 < / b:FETPAG >

    < b:CLIENTE > 61998 < / b:CLIENTE >

    < b:NOMBRE > MARIO ALFONSO PINEDA < / b:NOMBRE >

    < b:BANCO > 7 < / b:BANCO >

    < b:CAJERO > 1017 < / b:CAJERO >

    B1234 < b:BCID > < / b:BCID >

    < b:AVISOS >

    < b:AVISO >

    < b:REFPAGO > 201510533758 < / b:REFPAGO >

    < b:TIPOAVISO > 80 < / b:TIPOAVISO >

    < b:IMPTOTAL > 357.09 < / b:IMPTOTAL >

    < b:IMPMORA > 0.00 < / b:IMPMORA >

    < b:IMPMIN > 357.09 < / b:IMPMIN >

    < b:TIPOIMP > 67 < / b:TIPOIMP >

    < b:MONEDA > 76 < / b:MONEDA >

    < b:CODIGO_COMERCIAL > 2535510971 < / b:CODIGO_COMERCIAL >

    < b:CLIENTE > 61998 < / b:CLIENTE >

    < b:NOMBRE > MARIO ALFONSO PINEDA < / b:NOMBRE >

    < b:DIRECCION > BL E RETORNO 7Y8 N7302 COL NAKED < / b:DIRECCION >

    < b:RECIBOS >

    < b:RECIBO >

    < b:CODIGOFACT > 201510533758 < / b:CODIGOFACT >

    < b:FECHAFACT > 2015 - 11 - 11 T 00: 00:00 < / b:FECHAFACT >

    < b:FECHAVTO > 2015-11-30 T 00: 00:00 < / b:FECHAVTO >

    < b:IMPTOTAL > 357.09 < / b:IMPTOTAL >

    < b:IMPMORA > 0.00 < / b:IMPMORA >

    < b:TIPOIMP > 67 < / b:TIPOIMP >

    < b:MONEDA > 76 < / b:MONEDA >

    < b:EJERCICIO > 2015 < / b:EJERCICIO >

    < b:PERIODO > 10 < / b:PERIODO >

    < b:LECTANT > 611 < / b:LECTANT >

    < b:FECHLECTANT > 2015 - 10-01 T 00: 00:00 < / b:FECHLECTANT >

    < b:LECTACT > 728 < / b:LECTACT >

    < b:FECHLECTACT > 2015 - 11 - 02 T 00: 00:00 < / b:FECHLECTACT >

    < b:CONSUMO > 31 < / b:CONSUMO >

    < b:NUMSERIEAM > 5884 < / b:NUMSERIEAM >

    < b:CODIGO_COMERCIAL > 2535510971 < / b:CODIGO_COMERCIAL >

    < b:CATEGORIA > DOMESTICA < / b:CATEGORIA >

    < b:LINEAS_DETALLE >

    < b:DETALLE >

    Alcantarillado Sanitario < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 31 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 57,12 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Mantenimiento Medidor < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 1.50 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Costo fijo por Conexion < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 70.00 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Drinking Agua < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 31 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: ANY > 228,47 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Jubilado Descuento < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 0.00 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Interested por Mora < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 0.00 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Pendiente Saldo < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 0.00 < / b: MATTER >

    < / b:DETALLE >

    < b:DETALLE >

    Convenios < b:DESCRIPCION > < / b:DESCRIPCION >

    < b:CANTIDAD > 1 < / b:CANTIDAD >

    < b:UNIDMED > M3 < / b:UNIDMED >

    < b: MATTER > 0.00 < / b: MATTER >

    < / b:DETALLE >

    < / b:LINEAS_DETALLE >

    < / b:RECIBO >

    < / b:RECIBOS >

    < / b:AVISO >

    < / b:AVISOS >

    < / ProcesarComunicacionOnlineResult >

    < / ProcesarComunicacionOnlineResponse >

    < / Body >

    < / s: Envelope >

    It's my PL/SQL code:

    create or replace

    procedure SANAA_CONSULTA (Operación in varchar2,

    codigocomercial in varchar2,

    Banco in varchar2,

    cajero in varchar2,

    BCID in varchar2,

    p_recordset to sys_refcursor) as

    soap_request varchar2 (32000);

    CLOB soap_respond; -VARCHAR2 (32000);

    -soap_respond varchar2 (30000);

    http_req utl_http.req;

    http_resp utl_http.resp;

    RESP XMLType.

    CLOB resp1;

    -resp1 varchar2 (30000);

    resp2 varchar2 (30000);

    soap_err exception;

    v_code varchar2 (200);

    v_msg varchar2 (1800);

    number of v_len;

    v_txt varchar2 (32767).

    I have integer;

    tablaTemp varchar2 (2000);

    tablaTemp2 varchar2 (2000);

    tablaTemp3 varchar2 (2000);

    tablaTemp4 varchar2 (2000);

    tablaTemp5 varchar2 (2000);

    tablaTemp6 varchar2 (2000);

    CLOB vCampo;

    buffer varchar2 (32767).

    Start

    " soap_request: = ' < envelope soap: xmlns:soap = ' http://www.w3.org/2003/05/soap-envelope "xmlns:tem =" " http://tempuri.org/ "xmlns:sige =" " http://schemas.DataContract.org/2004/07/SiGe.Servicios.Sanaa « >' ||

    ' < soap: Header / > '.

    "< soap: Body >" |

    "< tem:ProcesarComunicacionOnline >" |

    ' <!-in option: - > ' |

    "< tem:msg >" |

    ' <!-in option: - > ' |

    "< sige:OPERACION >" | Operación | "< / sige:OPERACION > ' |

    "< sige:CODIGO_COMERCIAL >" | codigocomercial | "< / sige:CODIGO_COMERCIAL > ' |

    "< sige:BANCO >" | Banco | "< / sige:BANCO > ' |

    ' <!-in option: - > ' |

    "< sige:CAJERO >" | cajero | "< / sige:CAJERO > ' |

    ' <!-in option: - > ' |

    "< sige:BCID >" | BCID | "< / sige:BCID > ' |

    ' < / tem:msg > ' |

    ' < / tem:ProcesarComunicacionOnline > ' |

    ' < / soap: Body > ' |

    ' < / envelope soap: > ';

    http_req: = utl_http.begin_request ("http://181.210.29.198:8099/PagosLineaGGS/sige.servicios.sanaa.Pagoslineaservice.svc', ")

    "MESSAGE."

    "(HTTP / 1,1');"

    Utl_http.set_header (http_req, 'Content-Type', ' text/xml "");

    Utl_http.set_header (http_req, "Content-Length", LENGTH (soap_request) ");

    Utl_http.set_header (http_req,

    "SOAPAction",.

                          ' http://tempuri.org/IPagosLineaService/ProcesarComunicacionOnline');

    Utl_http.write_text (http_req, soap_request);

    http_resp: = utl_http.get_response (http_req);

    DBMS_LOB. CREATETEMPORARY (vCampo, true);

    loop

    Start

    Utl_http.READ_TEXT (http_resp, buffer, 32767);

    If the buffer is not null

    and length (buffer) > 0

    then

    DBMS_LOB. WriteAppend (vCampo, length (buffer), buffer);

    end if;

    exception

    while others then

    "exit";

    end;

    end loop;

    -utl_http.read_text (http_resp, soap_respond);

    Utl_http.end_response (http_resp);

    -RESP: = XMLType.createXML (soap_respond);

    -resp1: = resp.extract('/*').getStringVal ();

    Open the p_recordset for

    with XML in the form

    (select XMLTYPE (vCampo) as double OBJECT_VALUE)

    -(select XMLTYPE (resp1) in the OBJECT_VALUE of the double)

    -Select

    -Select *.

    Select the amount Descripción, unidmed, matter

    -Select *.

    XML,.

    XMLTABLE)

    XmlNamespaces)

                ' http://schemas.DataContract.org/2004/07/SiGe.Servicios.Sanaa ' « b »

              , ' http://www.w3.org/2003/05/soap-envelope/ ' as "s"

    , by default ' http://tempuri.org/ '

    )

    -'/ / b:DETALLE'

    -, ' / ProcesarComunicacionOnlineResponse/ProcesarComunicacionOnlineResult / b:AVISOS / b:AVISO / b:RECIBOS / b:RECIBO / b:LINEAS_DETALLE / b:DETALLE'

    , ' / s: Envelope / Body/ProcesarComunicacionOnlineResponse/ProcesarComunicacionOnlineResult / b:AVISOS / b:AVISO / b:RECIBOS / b:RECIBO / b:LINEAS_DETALLE / b:DETALLE'

    by the way the OBJECT_VALUE columns

    Descripción varchar2 (80) path "DESCRIPCIÓN."

    amount varchar2 (10) PATH "AMOUNT."

    unidmed varchar2 (10) path "UNIDMED."

    VARCHAR2 (2) any PATH 'MATTER');

    end SANAA_CONSULTA;

    But I get the following error:

    ORA-31011: Fallo en el Análisis XML ORA-19202: Se ha during an aforementioned LPX-00229 el error: input source is empty of XML ORA-06512: en "SYS. XMLTYPE", linea 272 ORA-06512: linea en 1

    Can someone give me a solution?

    Thank you in advance.

    You have specified namespace "s" wrongly, and you are not referencing the namespace "b" in your columns:

    SQL > ed
    A written file afiedt.buf

    1 with t (xml) as (select xmltype (to_clob (')))
    "" 2 http://www.w3.org/2003/05/soap-envelope "xmlns: a = 'http://www.w3.org/2005/08/addressing' > '.
    3
    4 http://tempuri.org/IPagosLineaService/ProcesarComunicacionOnlineResponse
    5

    6


    "7 http://tempuri.org/" >
    "' 8 http://schemas.datacontract.org/2004/07/sige.Servicios.Sanaa" xmlns:i = "http://www.w3.org/2001/XMLSchema-instance" > ".
    9 201510533758
    10 357.09
    11              0
    12              67
    13              76
    14 2015-11 - 30 T 00: 00:00
    15 61998
    16 MARIO ALFONSO PINEDA
    17              7
    18              1017
    B1234 19
    20
    21
    22 201510533758
    23                    80
    24                    357.09
    25                    0.00
    26                    357.09
    27                    67
    28                    76
    29 2535510971
    30                    61998
    31 MARIO ALFONSO PINEDA
    32 BL E RETORNO 7Y8 N7302 COL NAKED

    33
    34
    35 201510533758
    36 2015-11 - 11T 00: 00:00
    37 2015-11 - 30 T 00: 00:00
    38                          357.09
    39                          0.00
    40                          67
    41                          76
    42                          2015
    43                          10
    44                          611
    45 2015-10 - 01 T 00: 00:00
    46                          728
    47 2015-11 - 02T 00: 00:00
    48                          31
    49                          5884
    50 2535510971
    51 DOMESTICA
    52                          ')|| TO_CLOB (')
    53
    54 Alcantarillado Sanitario
    55                                31
    56                                M3
    57                                57.12
    58

    59
    60 Mantenimiento Medidor
    61                                1
    62                                M3
    63                                1.50
    64

    65
    66 Costo fijo por Conexi¾n
    67                                1
    68                                M3
    69                                70.00
    70

    71
    72 of drinking water
    73                                31
    74                                M3
    75                                228.47
    76

    77
    78 Jubilado Descuento
    79                                1
    80                                M3

    81                                0.00
    82
    83
    84 of interested por Mora
    85                                1
    86                                M3
    87                                0.00
    88

    89
    90 Saldo Pendiente
    91                                1
    92                                M3
    93                                0.00
    94

    95
    96 Convenios
    97                                1
    98                                M3
    99                                0.00
    100

    101
    102
    103
    104
    105
    106
    107
    108
    109 ')) double)
    110. -
    111 end of sample data
    112-
    113 select x.*
    114 t
    115, XMLTABLE (xmlnamespaces ('http://schemas.datacontract.org/2004/07/sige.Servicios.Sanaa' 'b'))
    116, "http://www.w3.org/2003/05/soap-envelope" as "s".
    117, by default 'http://tempuri.org/'.
    118                               )
    119,'/ s: Envelope / Body/ProcesarComunicacionOnlineResponse/ProcesarComunicacionOnlineResult / b:AVISOS / b:AVISO / b:RECIBOS / b:RECIBO / b:LINEAS_DETALLE / b:DETALLE'
    passage of 120 xml
    path of varchar2 (80) 121 Descripción columns '. / b:DESCRIPCION',
    122 varchar2 (10) amount WAY '. / b:CANTIDAD',
    123 unidmed varchar2 (10) PATH '. / b:UNIDMED',
    124 regardless of PATH number '. / b: MATTER '
    125*               ) x
    SQL > /.

    DESCRIPCIÓN AMOUNT UNIDMED MATTER
    -------------------------------------------------------------------------------- ---------- ---------- ----------
    Alcantarillado Sanitario 31 M3 57.12
    Mantenimiento Medidor 1 1.5 M3
    Costo fijo por Conexi¾n 1 M3 70
    Agua Potable                                                                     31         M3         228.47
    1 Jubilado descuento M3 0
    Intereses por Mora                                                               1          M3         0
    Saldo Pendiente                                                                  1          M3         0
    Convenios                                                                        1          M3         0

    8 selected lines.

    SQL >

  • Parse the JSON using PL/SQL string

    I created a script that reads data from the Mobile App DB (which is based on MongoDB) of Oracle SQL Developer. The result is the string JSON stored in l_response_text VARCHAR2 (32767);

    The string has the format such as:


    [{"Postcode":"47100","OutletCode":"128039251","MobileNumber":"0123071303","_createdAt":"2014-11-10 06:12:49.837","_updatedAt":"2014-11-10 06:12:49.837"}, {"Postcode":"32100","OutletCode":"118034251", ..... ]
    
    
    
    
    

    However, I need to analyze this l_response_text such that each table will in his column in a table called appery_test. appery_test table has the same number of columns pairs JSON and in the same order (e.g. name of the first column is 'postal Code')

    I searched and I found most of the results on the analysis of the Oracle in JSON table and not the other way around. I found, however, that link which is somewhat similar to my problem. However, the library suggested in the answer doesn't have an example on how to use it to insert JSON into conventional table using PL/SQL.

    N.B.: I use g 11 and not 12 c. If the functions built by are not available for me.

    Thank you very much

    Sorry, I am a novice in this area too.

    However, it worked for me:

    declare

    l_list json_list;

    l_data CLOB;

    Code postal clob;

    l_val json_value;

    Start

    -json data recovery

    Select the data in l_data from jsons where id = 1;

    l_list: = json_list (l_data);

    I'm looping 1.l_list.count

    l_val: = json_ext.get_json_value (json (l_list.get (i)), 'Postcode');

    DBMS_LOB.CREATETEMPORARY (zip, true, 2);

    json_value.get_string (l_val, postal code);

    -Put some things

    dbms_output.put_line (DBMS_LOB. GetLength (Postcode));

    dbms_output.put_line (dbms_lob.substr (postal code, 20, 1));

    DBMS_LOB.freeTemporary (Postcode);

    end loop;

    end;

    47328

    9J / / 4AAQSkZJRgABAQAA

    Added dbms_lob.freetemporary (postcode);

  • How to select only the part by using the sql query

    Hello

    I have the task to retrieve only the integral of the input text by using the sql query.

    The entry is as follows

    Entry for the price setting

    $12.5 (FYI without space)

    $ 12.5 (FYI single space)

    $ 12.5 (double space FYI)

    $12.5 (FYI multiple space)

    $12.5 (FYI multiple space)

    Output expected of 12.5

    The price is the type varchar2 column in the store_price table.

    Please let me know how to achieve this.

    Thanks in advance.

    If this is always the case that you get a $ followed by a number of places, you can use something like:

    Select to_number (ltrim ('$ 12.5',' $')) DOUBLE

    or

    SELECT ltrim ('$ 12.5',' $') OF double

    but take care of your nls_numeric_character settings if they are defined so that, for example, a comma is the decimal separator, you will have a problem.

    HTH

  • I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows?

    I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows so that I can do the calculations?

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date?

    Hello world

    During playback of Oracle ADF Real World Developer's Guide, I noticed the dates match occurring in JDeveloper is different from what is the list in the book. JDeveloper is failing to oracle.jbo.domain.Date, but according to the book:

    DATEjava.sql.DateDATE type is mapped to java.sql.Date if the column in the table is a no time didn't need information zone.
    DATEjava.sql.TimestampDATE type is mapped to java.sql.Timestamp if the column in the table has a component "time" and that the client needs to zone information.
    TIMESTAMPjava.sql.TimestampThe TIMESTAMP type is mapped to java.sql.Timestamp if nanosecond precision is used in the database.

    In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date? Using java.sql.Date and java.sql.Timestamp could save me some headaches conversion date. And, is there a place in JDeveloper to display these maps? I looked around and didn't see anything.

    Thank you.

    James

    User, what version of jdev we are talking about?

    In GR 11, 1 material versions db types date and timestamp are mapped to types of domain data that represents a wrapper for the native data types. The reason was that the framework can work with the domain types regardless of the underlying data type.

    Since Oracle 11 GR 2 maps the types DB to java types (default selection, you can change it when you create a model project, you can set the Data Type Mapping). Once the pilot has business components define you cannot change this setting it would break existing components such as eo or vo.

    So if you are working wit 11 GR 1 subject, you must use the domain types, if you work with GR 11, 2 or 12 c, you can use the domain types, but it is recommended to use the java type mapping.

    Timo

  • HELP required on forming the matrix of data using PL/SQL

    Hi all

    I'm new on this thread and need your help in this regard.

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL. My original data tables have 5000 lines each and I need to make a correlation analysis using these data and need to store in a physical table, and not in memory. This feat feasible the simple use of PL/SQL? I understand that Oracle DB has a limit of 1000 columns (but not sure) and so I would like to know if there is a workaround for this kind of scenario. If not, what are the other alternative methods to achieve this feat? Do I need to use any 3rd party tools to do this? A quick response from experts is highly appreciated.

    Thanking you in advance all the gurus.

    Rgds

    SAI

    1006089 wrote:

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL.

    Possible. But this will require a large part of the memory. As PL/SQL is a language server side, this means the server's memory. That means server potential resource problems.

    And that the server environment is a multiprocessu multi-user environment, it also means potentially several copies of this code of matrix running multiple processes, each putting a request very heavy on the resources of the server. Is no longer a matter of potential server resources, but a guarantee... (exactly the same problem if you use app server architecture and Java or .net)

    You have to ask what is the cracking of data, server-side language? The answer is SQL. No PL/SQL. SQL runs rings around PL/SQL, Java, C/C++ and other languages when it comes to complex, fast and scalable, processing of large volumes of data.

    So you ask yourself why use PL/SQL? With his expensive server memory footprint? SQL and not SQL tables that are designed to deal with massive data effectively and efficiently?

  • EMERGENCY required on forming the matrix of data using PL/SQL

    Hi all

    I'm new to this thread and need your emergency assistance in this regard.

    I have a requirement for the construction of a matrix of 5000 X 5000 using PL/SQL. My original data tables have 5000 lines each and I need to make a correlation analysis using these data and need to store in a physical table, and not in memory. This feat feasible the simple use of PL/SQL? I understand that Oracle DB has a limit of 1000 columns (but not sure) and so I would like to know if there is a workaround for this kind of scenario. If not, what are the other alternative methods to achieve this feat? Do I need to use any 3rd party tools to do this? A quick response from experts is highly appreciated.

    Thanking you in advance all the gurus.

    Rgds

    SAI

    DOUBLE WIRE!

    Now that you have published in your question in the forum SQL and PL/SQL please mark this thread ANSWERED.

  • Audit for each record in a table using PL/SQL

    Hello gurus,

    I would need your help to find the best approach to address to the below analysis using PL/SQL.

    I have a table that contains two columns

    Username and months

    I want to know the users who made orders each month during the first half of the 2012.That is the user ordered on Jan 2012, Feb2012... and June 2012.

    The table is huge and has more than 1 million records. How do I approach this in PL/SQL.

    --
    Joe

    You can use the cursor if you wish...
    Try this

    declare
    cursor c1 is
    SELECT user name, counting the months (separate months)
    From your_table
    Months WHERE the ("Jan 2012', ' February 2012', ' March 2012',..., 'June 2012'" ' ")
    GROUP BY userid
    HAVING COUNT (distinct months) = 6;

    Start
    I'm looping c1

    insert into insert_table (userid) values (i.userid);

    end loop;
    end;
    /

Maybe you are looking for

  • Allegedly bought sim-free Apple Store

    Greetings. We bought our daughter, we hope this is a sim free iPhone 6s, directly from the Apple Store in the neighborhood. I tried my best to make sure it was free of sim while there and the guy showed me the box and said "see, there no IMEI number

  • IP network address conflict cannot be resolved, while the media is disconnected

    I'm not too smart with computers.  I get a message saying that I have an IP address conflict.  I do what it says on the command prompt on the command ipconfig/release ipconfig/renew.  He said cannot set while the media is disconnected.   Have checked

  • Need help in activating the copy of Windows XP

    Original title: legal Options I have found several years after having my computer up to date, that my software for Office 2003 and Windows XP are not legal.  My Windows Media Player does not work either.  I have the disk for Windows 98, which would h

  • need help with windows vista

    I need help, 1 there is an error code 10 on Teredo Tunneling Pseudo-Interface, it indicates that the driver is unable to start. I click on find the solutions button but nothing happens. When I click on the button to update the driver it says it is al

  • Windows secure mail login

    Today a sure sign in box jumped up while trying to receive e-mails.  I entered my username and password and it will still not give me access to my new emails.  Can I disable this box?  What can I do to receive/send emails?