problem in the conversion of lines to a column

I use Oracle 10 g on Linux. I'm trying to concatenate the rows returned by the query. Since there are more than 50 lines to concatenate, therefore, I used the getClobVal() function. There are two problems with this release:


  1. < E > at the beginning and end of the output.
  2. Double quotation marks is replaced by & quote;


WITH T AS (
SELECT '{"startDate":"01-JAN-2999","processName":"RUNNING_BALANCE_PROCESS"}' json_objects   FROM dual
UNION
SELECT '{"startDate":"01-JAN-2999","processName":"CONTRACT_SYNCHRONIZATION_PROCESS"}' json_objects   FROM dual                           
UNION
SELECT '{"startDate":"01-JAN-2999","processName":"MTI_PEAK_BALANCE_PROCESS"}' json_objects   FROM dual                                  
UNION
SELECT '{"startDate":"01-JAN-2999","processName":"MAINTAIN_CASHPOOL_PROCESS"}' json_objects   FROM dual                                 
UNION
SELECT '{"startDate":"01-JAN-2013","processName":"CIL_FXH_PURGE_PROCESS"}' json_objects   FROM dual                                     
)
SELECT  rtrim (xmlagg (XMLELEMENT (E, json_objects || ',')).getClobVal()) json
FROM T



JSON                                                                            
--------------------------------------------------------------------------------
<E>{&quot;startDate&quot;:&quot;01-JAN-2013&quot;,&quot;processName&quot;:&quot;
CIL_FXH_PURGE_PROCESS&quot;},</E><E>{&quot;startDate&quot;:&quot;01-JAN-2999&quo
t;,&quot;processName&quot;:&quot;CONTRACT_SYNCHRONIZATION_PROCESS&quot;},</E><E>
{&quot;startDate&quot;:&quot;01-JAN-2999&quot;,&quot;processName&quot;:&quot;MAI
NTAIN_CASHPOOL_PROCESS&quot;},</E><E>{&quot;startDate&quot;:&quot;01-JAN-2999&qu
ot;,&quot;processName&quot;:&quot;MTI_PEAK_BALANCE_PROCESS&quot;},</E><E>{&quot;
startDate&quot;:&quot;01-JAN-2999&quot;,&quot;processName&quot;:&quot;RUNNING_BA
LANCE_PROCESS&quot;},</E>                                                       
                                                                                
1 row selected.

Elya wrote:

REPLACE converts CLOB VARCHAR2. The maximum size that could be 4000.

The output generated when it is applied to the actual data consists of 8897 characters. Replace function worked correctly.

True Yes sorry for my previous comment. I was wrong. REPLACE manages the CLOB. But this isn't the solution to your problem. You want to prevent the encoding of a certain nature while converting to XML. Using REPLACE you simply manage quotes, what other characters too can get encoded. For this you can do it like that.

SQL> with t as  2  (  3  SELECT '{"startDate":"01-JAN-2999","processName":"RUNNING_BALANCE_PROCESS"}' json_objects   FROM dual  4  UNION  5  SELECT '{"startDate":"01-JAN-2999","processName":"CONTRACT_SYNCHRONIZATION_PROCESS"}' json_objects   FROM dual  6  UNION  7  SELECT '{"startDate":"01-JAN-2999","processName":"MTI_PEAK_BALANCE_PROCESS"}' json_objects   FROM dual  8  UNION  9  SELECT '{"startDate":"01-JAN-2999","processName":"MAINTAIN_CASHPOOL_PROCESS"}' json_objects   FROM dual 10  UNION 11  SELECT '{"startDate":"01-JAN-2013","processName":"CIL_FXH_PURGE_PROCESS"}' json_objects   FROM dual 12  ) 13  select dbms_xmlgen.convert 14         ( 15             xmlagg 16             ( 17                 xmlelement(A, json_objects || ',') 18             ).extract('A/text()').getclobval() 19           , 1 20         ) str 21    from t;

STR--------------------------------------------------------------------------------{"startDate":"01-JAN-2013","processName":"CIL_FXH_PURGE_PROCESS"},{"startDate":"01-JAN-2999","processName":"CONTRACT_SYNCHRONIZATION_PROCESS"},{"startDate":"01-JAN-2999","processName":"MAINTAIN_CASHPOOL_PROCESS"},{"startDate":"01-JAN-2999","processName":"MTI_PEAK_BALANCE_PROCESS"},{"startDate":"01-JAN-2999","processName":"RUNNING_BALANCE_PROCESS"},

SQL>

Tags: Database

Similar Questions

  • What is the problem with the conversion of objects with gradients to the gradient mesh?

    What is the problem with the conversion of objects with gradients to the gradient mesh?

    Radial gradients are special, and it could become difficult edit the gradient mesh resulting.

    Take the layer apnel and inspect your objects. You will find a clipping mask the cracks inside.

  • Problem with the number of lines in the channel

    Dear community LabView,

    I'm relatively new to labview and I came across a problem that (I assume) can easily be resolved with your help.

    I need to create a digital signal to trigger a camera, but I have a problem with the configuration of my lines or exit lanes. I would not use that line output to trigger the camera. (I use a card NI PCIe-6353). LabVIEW is telling me that the number of lines in the channel does not have the number of rows of data:

    Possible reasons:

    Specified read or write operation failed because the number of rows in the data of a string is not the lines in the channel.

    If you use the digital waveform data type, make sure that the number of lines in the digital waveforms is the number of lines in the channel. If you are using Boolean data, make sure that the dimension of the array for the rows of the data is the number of lines in the channel.

    Number of lines in the channel: 1
    Number of data lines: 2

    Task name: _unnamedTask<11>

    How and why the number of data rows is connected to the resolution of my analog digital converter?

    I would appreciate your help! Labview code and a screenshot attached.

    Thank you

    Beff

    I got it to work by changing the "data format" "binary not signed" OR by plugging is not the "offset" for the Square Wave VI.  I think that the default "offset binary" data format works correctly if there is a negative value.

  • Problems with the conversion of Word files to PDF via macro

    I have a weird problem with the Acrobat add-in. I want to convert a lot of files with the Word Add-In in PDF files. The printer is no option because it causes other problems.

    So I created a small macro for Word that transforms all the Word of a directory of files PDF files. The macro works great, but PDF files look right.

    I show you the problem with a Word file, first converted manually, then with the macro:

    First of all the image:  If the file is converted manually, it seems that the Word file and fonts are included.

    convertedManually.png

    Second picture: If the macro converts the file it doesn't seem correct and the fonts are usually not included.

    convertedWithMacro.png

    I use Acrobat XI and Word 2010. The macro command is:

    ' new name for PDF
    pdfName = Replace(Replace(verz & "\" & fi.Name, "docx", "pdf"), "doc", "pdf")
                ' convert Word into PDF
                ActiveDocument.ExportAsFixedFormat OutputFileName:= _
                    pdfName, ExportFormat:= _
                    wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
                    wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
                    Item:=wdExportDocumentContent, IncludeDocProps:=False, KeepIRM:=False, _
                    CreateBookmarks:=wdExportCreateHeadingBookmarks, DocStructureTags:=True, _
                    BitmapMissingFonts:=False, UseISO19005_1:=False
    

    I did not, but the trick is to realize you don't want specific action. Rather, you want to treat a directory. DOCX files in the directory will be converted to PDF, then actions (if any).

  • Problem with the conversion of Midlet (jad/jar) cod file (Jasymca 2.0)

    BB Storm last official OS.

    There is this wonderful program called Jasymca 2.0 which is a combination of programs of mathematics MATLAB and MAXIMA of high-end (subset to fit) and written in J2ME as a MOPED. To see a demo of it, go to http://webuser.fh-furtwangen.de/~dersch/jasymca2/indexEN.html and click on demo on the left. It's quite impressive... able to make the symbolic math and math matrix among others. The ultimate calculator for a PDA... and the best I could find out there.

    The only problem is that it is written in J2ME as a MIDLET and the runtime is stored as a combination of jad/jar. Now, I tried the standard conversion using the CAP as follows...

    CAP import = "C:\Program Research In Motion\BlackBerry JDE 4.7.0\lib\net_rim_api.jar" code name is jasymca-midlet jad is Jasymca.jad Jasymca.jar

    It seems to work very well. There are a few warnings about unused variables, but that's fine. The last line was "No Errors".

    .. .and he left me with a file .cod 229K

    When I insert it in my blackberry through javaloader, it loads very well.

    However, when I look in my download directory I 2 files related to Jasymca and not running.

    I suspect that it is because the cod file is too big. Is there another step I can do for the cod of the loadable file?

    Any help is appreciated.

    Thank you

    -Donald

    It takes more time than I expected.

    There is a preprocessor directives in the source files and to leave JDE to understand these guidelines, I need to modify the jdp.

    I stopped the investigation

    But I will say that I found.

    icons and data files must be located in the default folder.

    If the root folder of the package is src\

    path of the icon should be: src\myicon.png

    for now the icons are located in the src\icons folder

    in this case the image files are not accessible from the BlackBerry App.

    The second: there are some files showed up as the symbol file name first.

    JDE does not add these files to the project.

    I think that the best way would be to contact the developer of Jasymca and talking to him about the Jasymca and porting for BlackBerry

  • Problem with the conversion of pdf to IBR

    Hi, I have problem with IBR excel file conversion. File do not have a password, but in newspapers, I have:
    Manager of tasks/7 02.14 10:46:19.732 TaskLauncher_CmdLineConversion_44409_exsimple_stderr read 72 bytes: EXOpenExport() failed: file is password protected or encrypted (0x000B)
    Excel has macro and security for the worksheet.

    I can't find any post or information about it.
    Any idea, documentation?

    refer to http://docs.oracle.com/cd/E23549_01/doc.1111/e10800/c03_pdfi_all.htm#CIHCGCJA

    "To avoid a conversion of a file Microsoft Office expired, all functions that require a user input must be disabled. It is password protection, security notifications, such as disabling macros, and requests for online access to show online content or participate in programs of feedback from users. For more information about how to disable these and other similar goods, refer to Microsoft documentation for each product. »

  • Problem with the conversion of Partition Boot Camp

    I would have just dl and installed the trial version of 3.0.  After running and by selecting the boot camp for the boot partition, merge began to 'prepare' the partition for use.  After about 45 minutes, the process had not been completed.  I grew up the activity monitor and found that the process did nothing.  I closed the process, thinking I could start over again at the launch of Fusion.  Wrong, merger saw the partition boot camp into a virtual machine that could not be started.

    Is there a possible way to start the process of 'preparation '?  It is apparently the only way to correct the problem.

    Tried from a support ticket, but could not do while I wasn't a registered owner.

    I'm trying to make my choice between Parallels and Fusion, or just stick with BootCamp.  I hope someone can help me with this problem.

    Harry

    Dear Harry,

    I did the same thing yesterday. My BootCamp partition has Windows XP (SP3) and I also have Parallels. I'm now trying to decide if I stay with Parallels or Fusion 3 (to take a possible advantage over the 64-bit @ Snow Leopard).

    My upgrade was fine, it took about 15 minutes to get BootCamp running on the merger. A small step has been to re - activate my XP with Microsoft license, because the "material" changes. I have the MACBOOK PRO 13 '' 2.53 with 4 GB of RAM. I don't really have time to play yesterday, but between Parallels and Fusion 3, (64-bit), I did not see too much improvement on the 'speed '.

    An advantage of having any of virtualization software, is that you can have multiple operating systems running, such as XP, Windows7, etc. I need that because my work, the developer. If you can stay only with an operating system, I guess, BootCamp works very well.

    Kind regards

  • Problem with the conversion of the date

    Hello

    I have a column called period_name which is of type varchar which contains data as jan-02 Feb-03 and 05-02, now my requirement is I want convert month names number say jan-02 to 01-02.

    I tried to use to_char (to_date(period_name,'mm/yy'), 'mm - yy') which gives good results to the selection, but when I use the same creation then Sunrise error


    [Error] Run (58:24): ORA-01858: a non-digit character was found here where was waiting for a digital


    Query:

    create the table dumm1 as
    (
    Select to_char (to_date(period_name,'mm/yy'), 'mm - yy') in the period_name of xx_alll
    )

    Concerning

    Published by: 862807 on June 13, 2011 03:30

    862807 wrote:

    Here when I write a select statement which I produced earlier works fine, but when I write the same create in her statement generates an error.

    No it's not.

    You're not extract all lines, you use Toad or some other GUI to confuse you. Enter the results data grid and type CTRL + end to fetch the last row. Or use sqlplus. The selection will fail too.

  • Problem with the input TextField line number

    It's driving me crazy. I have a textfield with the input of type value. I want to delete it when the user presses enter on the ground and the carrot to return to the first line of text. However when I do this, I can never get the carrot to return to the first line, after I clear the field and he's always on the second line. If anyone knows the solution, please let me know. Here's the code that creates the field and clears it.

    The ScrollableTextEvent allows just my request to know that the key was pressed without the SHIFT key down. My application then calls the clear function.

    use a delay (1ms is fine) to call clear().

  • Problem with the conversion of getDate() to Date format?

    Hi guys,.

    I need to convert the date selected for DateField string format (for example: yyyy-mm-dd).

    I put the date format DateField as "mm-dd-yyyy '.»

    I tried to get the date of this DateField and tried to convert the format 'yyyy-mm-dd ".

    When I tried, I had a bad outing.

    For example, when I selected 12 months he returned as "00" the following coding.

    SimpleDateFormat dtFormat = new SimpleDateFormat("yyyy-mm-dd");
    Date dtToConvert = new Date(mydatefield.getDate());
    strRequired = dtFormat.formatLocal(dtToConvert); 
    

    Can someone explain what that is the bug with this code or any other way to get the output as my requirement?

    Thanks in advance,

    Stéphane

    Oops, sorry, code should have been...

    DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    long dateLong = field.getDate();
    Date date = new Date(dateLong);
    String dateString =df.format(date);
    
  • Problem with the conversion date by default.

    Hello

    I use JDeveloper 11.1.1.3. I have a 'read-only through sql access' VO in which I defined a query to retrieve the attribute "issuedate" of a table. The query is as follows:
    select to_date(issuedate,'dd-Mon-yyyy') issuedate from administration_circulars
    I tried using a spreadsheet sql and it worked fine (for example, it returns 'January 16, 13')

    However, in my application, I have a system on a chip to display this attribute. When I try to launch the application, I get "13/01/16. Anyone has any idea on this? I even tried to change the format from data of the user interface in the view object to 'none' so far so 'simple' value 'dd-Mon-yyyy', but it works at all.

    Thank you

    Mohamed.

    Have you tried it in a sql worksheet?
    It should return the date in the format as a string.

    Timo

  • Download data - problems with the conversion of the date

    Hello

    I have a picture that I downloaded from a database of oracle using SAS. It has a column with dates in the following format: 10/31/2012 11:00

    When I download the data (via workshop SQL-> utilities-> data workshop-> load data) by categorizing my dates as varchar2, everything works fine... but fails when I choose my type in the Date column.

    Please advice how to fix this

    Thank you

    K I import my data with other tools. Looking at the workshop of data utility, no doubt you would put MM/DD/YYYY HH: mi: SS AM in the 'Format' field for this column.

  • How to solve problems with the conversion of an email/webpage to PDF?

    I want to convert a newsletter by e-mail (600px wide and a sunken length - about 4 pages)) into a pdf file.

    If I view the document in a browser and then use it to create a PDF from Web page - I use Acrobat Pro 9 - it creates it is fine, but displays the document in the default page, which currently is A4. However, the title of original shows at the top of each of the 4 pages, and shows the address of the site at the foot of each page before the pagebreak.

    Can anyone tell how I can convert without these "extras" if it pleases you, and is there anyway to convert this type of document to PDF without going through these page breaks?

    You can disable the URL in your web browser in the layout. To change the stretchy header, go to the preferences of add-on PDFMaker in your browser and clear the checkbox "place headers and footers on the new page. Tab available, in this same dialog box, you can adjust the size of the page.

  • Problems with the conversion of files to the word

    I recently downloaded the judgment of Adobe Acrobat Pro XI for the possible purchase of my company.  I would like to convert it the letters that I worked with for Word while trying to work in Adobe.  When I did this, changed the dynamics of the letter.  It likely to change the letters, or even come as winddings.  What I am doing wrong?

    What I am doing wrong?

    Nothing. You simply overestimate the powers of the process. This is an approximation, but 90% time of manual editing and cleaning of files that results is necessary.

    Mylenium

  • How to select rows randomly by the percentage of lines by specific column

    I need to select exactly 20% of lines by Department randomly. Ex, table composed of 50 records for the Sales Department, 60 discs for the Department of human resources. I need to get 10 records of the Department sales and 12 records of Department of human resources. but records should be chosen at random. How to get out of it? Thanks in advance.

    Select

    DEPTNO

    count (*) NTC

    WCP

    Deptno group

    DEPTNO CNT

    30 6

    20 5

    3 of 10

    Choose 50% in every department at random

    expected (round up to the next integer)

    DEPTNO CNT

    30 3

    20 3

    2 of 10

    Select * from)

    Select

    EmpNo

    deptno

    , count (*) during the (partition deptno) cnt

    row_number() over (partition by deptno arrested by dbms_random.random) rn

    WCP

    )

    where rn<=>

    order by deptno

    EMPNO DEPTNO CNT RN

    7782 10 3 1

    7934 10 3 2

    7566 20 5 1

    7876 20 5 2

    7902 20 5 3

    7900 30 6 1

    7521 30 6 2

    7654 30 6 3

Maybe you are looking for