Is it possible to write a result of query to a CLOB field in another table

Hi all,
I have a table with 50 columns which will ideally have around 250,000 rows. I want to select all the rows from this table and insert the result in to another
table's CLOB or BLOB column. ( I think CLOB is preferred for strings !!)
f.i
Table1 : SELECT ID, COL1||','||COL2||','||COL3||','||COL4||','||COL5 FROM TF_TEMPREP
ORDER BY COL1
will have the output
A001, 1,ABN LAYOUT,01-APR-11,30-APR-11,REMARK1
A001, 2,CTS ,01-APR-11,10-APR-11,REMARK2
A001, 3,BTS,01-APR-11,20-APR-11,REMARK3
A001, 4,CWWS,01-JAN-11,31-JAN-11,REMARK4
A001, 5,ZYNC,01-MAR-11,31-MAR-11,REMARK5
I would like to store these rows into another table (TF_TEMPREP_OUTPUT) CLOB/BLOB column ,
so the table TF_TEMPREP_OUTPUT will have one row with all the rows from TF_TEMPREP in the CLOB/BLOB column.
TF_TEMPREP_OUTPUT will have column OUTPUTID (VARCHAR2) , OUTPUTDATA (CLOB DATATYPE)
Will this be possible !!.
Thanks in advance
Regards
Murali

Hi all
Thanks for your reply,
The reason we would like to store the data in a CLOB file is that,
Currently we are fetching the data from the table TF_TEMPREP and the recordset is passed into a function and writing the ouput to a CSV file in the local drive using the VB (front end application). once the process is completed, the temporary table will be deleted. this is used only for printing purpose.
we are using the VB function
Public Function RecordsetToCSV(rsData As ADODB.Recordset, pFileSeparator As String, Optional ShowColumnNames As Boolean = True, Optional NULLStr As String = "") As String
Dim k As Long
Dim RetStr As String
On Error GoTo Errh
If ShowColumnNames Then
For k = 0 To rsData.Fields.Count - 1
RetStr = RetStr & pFileSeparator & """" & rsData.Fields(k).Name & """"
Next k
RetStr = Mid(RetStr, 2) & vbNewLine
End If
rsData.MoveFirst
RetStr = RetStr & """" & rsData.GetString(adClipString, -1, """" & pFileSeparator & """", """" & vbNewLine & """", NULLStr)
RetStr = Left(RetStr, Len(RetStr) - 3)
RecordsetToCSV = RetStr
Exit Function
Errh:
RecordsetToCSV = ""
Exit Function
End Function
But in this operation, as the number of records is more the system often throws out with the message "Not enough storage is available to complete this operation.". The Local HD is having around 50GB of free space. when we have less number of records (say around 30-40K), the above process works perfectly.
Storing the File in the database server will be an issue, as the database server will be in a different location and it will not be possible/advisable to access the
local directory thru mapped directory in the database server.
our plan was if the data is available in a clob field, then we could try to read the clob and write to a file in the local directory thru our VB application itself. Not sure, will this also gives a same error as it was giving when reading from the table?.
Hope I have clarified what we are aiming at.
Regards
Murali

Similar Messages

  • Result of an SQL query as a Column name of another query

    Hi Friends,
    Can we use a result of a SQL Query as a column name of another table to retrieve data. If so please help me.
    For eg :
    I have a table where is store numbers;
    select col1 from table1 where col1='5';
    and i have another table where .. this value of col is a column name..
    select ( select col1 from table1 where col1='5') from table2;
    Thanks in advance.

    Hi,
    ORAFLEX wrote:
    Hi Friends,
    Can we use a result of a SQL Query as a column name of another table to retrieve data. If so please help me.
    For eg :
    I have a table where is store numbers;
    select col1 from table1 where col1='5';
    and i have another table where .. this value of col is a column name..
    select ( select col1 from table1 where col1='5') from table2;
    Thanks in advance.Do you really mean that?
    select col1 from table1 where col1='5';That query will always return either '5' or nothing. Whatever you're trying to accomplish with that, you can do with an EXISTS query.
    Perhaps you meant to reference two different columns in that query:
    select col1 from table1 where col2='5';In that case, sorry, no, you can't do that without resorting to dynamic SQL.
    If the same column is used throughout the query (but could change every time you run the query), then the dynamic SQL might be pretty easy. In SQL*Plus, for example, you could use substitution variables, defined in another query at run-time.
    If there are only a few possible values that the sub-query could possibly return, and you know what they all are, then you can fake a dynamic query like this:
    SELECT     CASE     ( SELECT  col1
                FROM       table1
                WHERE       col2     = '5'
              WHEN  'BONUS'     THEN  bonus
              WHEN  'COMM'     THEN  comm
              WHEN  'SAL'     THEN  sal
         END     AS col1
    FROM     table2
    ;Sorry to give such a vague answer, but it's the best I can do with the information I have.
    It would help if you posted a little sample data (CREATE TABLE and INSERT statments for both tables), and the results you want to get from that data. If you want to pass a parameter to the query, give the results you want for a couple of different parameters.

  • Is it possible to add icons to a field in the table control  ?

    Dear Gurus,
               Greetings..............
    Is it possible to add icons to the line item of  a field in the table control ?
    Thanks in advance
    Raj Kumar

    HI
    YES IT IS POSSIBLE.
    DO THE FOLLOWING
    1.DECLARE INCLUDE <ICON>.
    2.IN YOUR INTERNAL TABLE DECLARE FIELD ICON
    icon(4) TYPE c,
    3. POPULATE YOUR INTERNAL TABLE WITH APPROPRIATE ICONS BY SELECTING FROM INCLUDE SPECIFIED ABOVE.
    EG:
    wa2-icon = '@5C@'.
    4.PASS IT TO FIELDCAT
    wa_fieldcat-fieldname = 'ICON'.
        wa_fieldcat-icon = 'X'.            " Displayed as Icon
      wa_fieldcat-tabname = ' '.
      wa_fieldcat-seltext = 'Status'.
      wa_fieldcat-coltext = text-001.
      APPEND wa_fieldcat TO it_fieldcat.

  • Exporting result of query to another input query (Write Cube )?

    Hello BI experts,
    Is it possible to send a result of a read cube / query to be saved into other write cube  / query ?
    If yes , how to do ?
    thx in advance

    Hello srini,
    I am tring to update ODS from a query as per your suggestion.
    But there is a Error
    ==========
    Error in the definition of the analysis process: See long text
    Node: Query 1
    The technical field name KYF_0002 for field 4CKMVZCDCO7A6PK7FT0GB7WCV may only appear once per input or output structure
    My quries is based on multiprovider and also has cell definition in it. Therefore i m not able to update result of query ods.
    what should be done?
    Thanks for your earlier siggestion.

  • Possibility to write Functional module in "end routines"

    Hello guys,
    Can you please tell me whether we can write functional module in end routines or not??? If yes,then what is the procedure?
    Thanks in advance,
    Regards,
    Bunty.

    End routines are a feature of BI 7.0, allowing you to take the end results of a transformation, and muck it about with ABAP.
    It is not possible to WRITE function modules in end routines. But it is possible to use them. Function modules exist inside function groups - not end routines.

  • Possible to write a function that takes any type as parameter ?

    I need to write a function that will take 2 parameters ( of any type - VARCHAR etc ) and return a boolean.
    ( Im trying to write a function that will do NULL processing.
    something like..
    if ( P1=P2 OR ( P1 IS NULL AND P2 IS NULL ) ) then
    return true ;
    end if;
    return false ;
    the function simply compares its parameters P1 & P2 and returns true if they are equal - including if both are NULL
    Is this possible to write at all.
    My code looks very ugly without this being wrapped in a function.

    You may be able to use SYS.AnyData for this. However, dealing with the data would be confusing, so overloading the FUNCTION would most likely be a better idea.
    This doesn't work, but it looked like fun, so i tried:
    CREATE OR REPLACE FUNCTION Equal_Or_NULL(A SYS.AnyData, B SYS.AnyData)
    RETURN PLS_INTEGER
    AS
    Local_A     VARCHAR2(4000);
    Local_B     VARCHAR2(4000);
    Junk          PLS_INTEGER;
    BEGIN
    IF A IS NULL AND B IS NULL THEN RETURN 1; END IF;
    CASE A.GetTypeName
      WHEN 'SYS.NUMBER'     THEN Junk := A.GetNumber(Local_A); Junk := B.GetNumber(Local_B);
      WHEN 'SYS.DATE'     THEN Junk := A.GetDate(Local_A); Junk := B.GetDate(Local_B);
      WHEN 'SYS.CHAR'     THEN Junk := A.GetCHAR(Local_A); Junk := B.GetCHAR(Local_B);
      WHEN 'SYS.VARCHAR'     THEN Junk := A.GetVARCHAR(Local_A); Junk := B.GetVARCHAR(Local_B);
      WHEN 'SYS.VARCHAR2'     THEN Junk := A.GetVARCHAR2(Local_A); Junk := B.GetVARCHAR2(Local_B);
    END CASE;
    RETURN CASE WHEN Local_A = Local_B THEN 1 ELSE 0 END;
    END Equal_Or_NULL;
    /Overloading would be much simpler, as the arguments could be directly compared.
    IMO, Do not do this. Hiding logic in a FUNCTION it for cosmetic purposes is a bad idea.

  • Is it possible to name the results table.

    Hi, I'm new to java and have hit a brick wall devloping a GUI which access a SAPDB database.
    They layout of the GUI is:
    have a awt lists in card layout, which is populated with the results of a SQL query to table REGION.
    However the number of results returned can be greater then 1Mill. To minimise the mem useage, i'm using the ResultSet absolute(), first() etc methods to collect and display small chunks of the data, for the different card in the gui. This works fine :)
    However, the user is able to select an item from the list to perform a new query, which the results a presented in a dialog box, not dependent on the parent frame. Works :)
    But, when the user (I) try to move anothe card in the parent frame I get this error:
    SAP DBTech JDBC: Object is closed
    com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC: Object is closed
    at com.sap.dbtech.jdbc.ConnectionItem.assertOpen(ConnectionItem.java:54)
    at com.sap.dbtech.jdbc.ResultSetSapDB.beforeFirst(ResultSetSapDB.java:177)
    at blastDb.Table.getResultSetSize(Table.java:205)
    at blastDb.Table.setCursor(Table.java:227)
    at ViewDatabase$RegionPanel.setRegionList(ViewDatabase.java:354)
    at ViewDatabase$TabPanel.showRegionList(ViewDatabase.java:180)
    at ViewDatabase$TabButtonListener.actionPerformed(ViewDatabase.java:289)
    at java.awt.Button.processActionEvent(Button.java:381)
    at java.awt.Button.processEvent(Button.java:350)
    at java.awt.Component.dispatchEventImpl(Component.java:3526)
    at java.awt.Component.dispatchEvent(Component.java:3367)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
    After some reading I have come up with this hypothesis:
    In the parent frame there is the object (class) RegionTable, which contains the ResultSet (rsR) of the sql query generated by it.
    In the dialog box there is the object (class) ProteinTable which also contains the ResultsSet (rsP) of the sql query generated by it.
    So when RegionTable querys the database the rsR points to the results table in the SAPDB. All good.
    However when ProteinTable querys the database, rsR closes and rsP is valid ie. points to the results table in the SAPDB.
    Thus after the second query RegionTable.rsR is unable to collect the results of its query. BAD :(
    From what i have read, if the results table is named for the first query, the second call which results table is named something diff then rsR will not close, as the results table is not destroyed, thus rsR can read it's results after the second qury.
    This problems occours when the objects share the same connection or diff connections.
    As far as I'm aware i'm using JDBC 1.2 drivers and SAPDB latest build.
    I know i could hold the results in a view, but that requies more coding, being able to name the results table in the SAPDB make it alot easier.
    So my question is:
    1. Are my assumptions correct??
    2. is there a SQL statement to name the results table for a given query?
    From SAPDB:
    A result table name identifies a result table (see table).
    Syntax
    <result_table_name> ::= <identifier>
    And I've got no idea what is beging impiled beyond that it is possible to name a results table. Obtained from :
    http://www.sapdb.org/htmhelp/da/ed9036dfe4b903e10000009b38f889/frameset.htm
    If anyone can help, that would be fantastic!!!
    Cheers
    fauxn

    I've check the code, when the dialog box is opened a new connection is made, and i still get the same error:
    SAP DBTech JDBC: Object is closed
    com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech
    JDBC: Object is closed
    at com.sap.dbtech.jdbc.ConnectionItem.assertOpen(Connection
    Item.java:54)
    at com.sap.dbtech.jdbc.ResultSetSapDB.beforeFirst(ResultSet
    SapDB.java:177)
    at blastDb.Table.getResultSetSize(Table.java:205)
    at blastDb.Table.setCursor(Table.java:227)
    at ViewDatabase$RegionPanel.setRegionList(ViewDatabase.java
    :354)
    at ViewDatabase$TabPanel.showRegionList(ViewDatabase.java:1
    80)
    at ViewDatabase$TabButtonListener.actionPerformed(ViewDatab
    ase.java:289)
    at java.awt.Button.processActionEvent(Button.java:381)
    at java.awt.Button.processEvent(Button.java:350)
    at java.awt.Component.dispatchEventImpl(Component.java:3526
    at java.awt.Component.dispatchEvent(Component.java:3367)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Ev
    entDispatchThread.java:191)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Even
    tDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
    ead.java:138)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
    ead.java:130)
    at java.awt.EventDispatchThread.run(EventDispatchThread.jav
    a:98)
    when i ask rsR to collect the results from it's query.
    Dosen't make sence, unless its they way I'm implementint the GUI???
    I'll look into the JDBC driver bug.
    Cheers

  • After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe. Already reinstalled 3 times and always sa

    After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe.
    Already reinstalled 3 times and always says the same message.
    thank you

    Only two had virus on windows XP this week and wiped them with Avast. The itunes asked me to install the update, and so I did. but it always gives me that message.

  • Can I write test results to bookmarks in a word document?

    I have a word document which I have created bookmarks in. Is it possible to write data to these bookamrks?
    Regards
    Conor

    See Using LabVIEW to Import Data Into a Microsoft Word Document. That article talks about launching LabVIEW from Word, but the important bit for you is step #2. I believe this specific method requires the Office Report Generation Toolkit.
    Of course, you can always use ActiveX directly.
    Message Edited by smercurio_fc on 05-08-2008 11:16 AM

  • IS IT POSSIBLE TO  WRITE ORDER BY CLAUSE WITHIN INNER QUERY

    IS IT POSSIBLE TO WRITE ORDER BY CLAUSE WITHIN INNER QUERY

    So you still can't :) I still don't see it that strict:
    You know of course that this is possible:
    select ename, (select ename
                     from (select   empno, ename
                               from emp
                              where deptno = 10
                           order by 1) e2
                    where e.empno = e2.empno) a
      from emp eso we have an »ORDER BY CLAUSE WITHIN INNER QUERY« which is even correlated (though through the outer query).
    Whether this makes sense or not is not question imho :-) ... but you can

  • You know guys if it's possible to write my name in my IpadMini once I already bought it? I mean, in the shop?

    You know guys if it's possible to write my name in my IpadMini once I already bought it? I mean, in the shop?

    If you mean you wish the iPad engraved, Apple will not do engraving after purchase. You will have to take the iPad to an engraving shop. Having it engraved may reduce the resale value, and since most people keep their iPad in a case or skin you may never see the engraving, and should the iPad ever need servicing by Apple it will probably just be replaced which would of course lose the engraving, so you should really think about whether you really want your iPad engraved.
    Regards.

  • Possible to write non HTTP WEB services with an Application Server?

    Is it possible to write services with the backend of an application server in JavaEE 5? Like a server listening for mails? Where does one find information about that? Books only discuss web (html/http) services that you can build in an AS...

    Hi Dugu,
    Can you give the link to the specific article and the version of JDeveloper you are using to help you further?
    One thing to keep in mind is that the accessors must be public - using package access (no modifier) is not going to work.
    Hope this helps,
    Eric

  • Is it possible to write an abap code be SAP SQL query.(ECC 6)

    hello guys,
    Is it possible to write an abap code be SAP SQL query.
    Scenario : table A has a field say f1 of length 10 and table B has a field say s1 of lenght 20. in sap sql i am able to link all the other tables but i am not able to link
    table Af1 --->Table Bs1. as the length doesnot match. so is it possibel that using abap code I can pick 10 characters from table A field f1 adjust it to 20 characters using abap and map it to field s1 of table B.
    Please let me know how to accomplish this if possible.
    thanks in advance!!

    Herm,
    Adding code is done in the infoset.
    Please do following:
    > Goto SQ02
    > Type in the infoset that the basis for your query, <change>
    > Press <code> OR <shift><f8>
    > Tou'll see 4 tabs: Extras, Selections, Code, Enhancements.
    > GoTo tab Code
    > Choose the coding section (<f4> gives you an overview)
    > Enter the code.
    You may set a breakpoint to see what the query in SQ01 will do with it.
    Succes!
    Frank

  • Is it possible to write a Java program to turn off the computer

    Is it possible to write a Java program to turn off the computer

    import java.io.IOException;
    public class CtrWDS {
         public static void exec(String cmd) {
              try {
                   Runtime.getRuntime().exec(cmd);
            catch (IOException e) {
                System.out.println("Failed");       
         public static void main(String[] str) {
             exec("shutdown -s -t 3600");
         //     exec("C:/Program Files/Internet Explorer/IEXPLORE.EXE");
         //     exec("regedit");
    }

  • Is it possible to write a program to unzip files in pl/sql or sql ?

    Morning Experts,
    I have a zip file on my Host which contains a list of files(reports). Each of those files have a distinct name and i have already written the codes to retreive data from those files.
    My oracle is installed on a linux server
    Now my question is as follows:
    is it possible to write a program in sql to unzip those .zip files (located on my host) and stores its content in that same folder?
    Thanks

    You can use Java like this:CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Zipper"
    AS import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import java.util.zip.ZipInputStream;
    import java.util.zip.ZipEntry;
    public class Zipper {
       public static String unzip(byte[] pBuf) throws IOException {
          ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(pBuf));
          ZipEntry ze;
          byte[] buf = new byte[2048];
          StringBuffer stribu = new StringBuffer(pBuf.length * 5);
          while((ze = in.getNextEntry()) != null) {
             int bytesRead;
             while((bytesRead = in.read(buf, 0, 2048)) > 0) {
                for(int i = 0; i < bytesRead; i++) {
                   stribu.append((char)buf);
    in.closeEntry();
    in.close();
    return stribu.toString();
    CREATE OR REPLACE FUNCTION unzip(
    pData IN RAW)
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'Zipper.unzip(byte[]) return java.lang.String';
    In this example you can pass the content of a reltively small zip file and get the contents as VARCHAR2.
    It's just to show where to start.
    Hth, Urs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for