Script table with Clob and record another database

Hello

How can I read the Clob column data and insert into another table in the database.

The first Table is quality Test and second Production

Is there a way without using Export / Import?

What can I use the charger?



With the help of 9i

muttleychess wrote:

mschnatt wrote:
You can only try the db-link

CREATE LINK of the DATABASE to CONNECT to IDENTIFIED BY with the HELP of "";

and make the table

create table...
in select...

Thank you, but too no work :-(:-(

SQL> select id,clob_data from myclob@teste;
select id,clob_data from myclob@teste
*
ERRO na linha 1:
ORA-22992: cannot use LOB locators selected from remote tables

Well you don't have the answer said to

and make the table

create table...
in select...

Also in the manual, you could save a lot of time if you open.

http://docs.Oracle.com/CD/B14117_01/AppDev.101/b10796/adlob_wo.htm#1006314

>
The following syntax is supported on the remote LOB columns:

CREATE TABLE t AS SELECT * FROM table1@remote_site;
INSERT INTO t SELECT * FROM table1@remote_site;
UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
INSERT INTO table1@remote_site select * from local_table;
UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
DELETE FROM table1@remote_site 

It is the only syntax support involving some LOBs in remote tables. No other use is supported.

Tags: Database

Similar Questions

  • GetLength errors on CLOB. Retrieves the size of a table with CLOB columns

    Hello

    I try to find the size of a CLOB to a table column and get the error

    PLS-00306: wrong number or types of arguments in the call to "GETLENGTH.

    When you try to use dbms_lob.getlength. Here is the code


    declare
    number num.
    Start
    for rec in (select xmlupload from FILE_TABLE where file_table_id = 33635) loop
    NUM: = dbms_lob.getLength (rec.xmlupload);
    end loop;
    dbms_output.put_line (num);
    end;

    Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi


    I'm actually trying to find the size of a table with CLOB columns, is there an easy way to do this Besides using getlength and without having to contact the Administrators (they are outsourced)?

    It works fine on my computer, the version is also 10g.

    SQL> declare
      2  num number;
      3  begin
      4  for rec in (select cntnt from ims_toms_msge where rownum<3) loop
      5  num := dbms_lob.getLength(rec.cntnt);
      6  dbms_output.put_line(num);
      7  end loop;
      8
      9  end;
     10  /
    3837
    3837
    
    PL/SQL procedure successfully completed.
    

    You should check if xmlupload is the CLOB data type.
    In addition, if you just want to get the CLOB size, you can use LENGTH() as well, you will get the same result;

    SQL>  select length(cntnt), dbms_lob.getLength(cntnt) from ims_toms_msge where rownum<2;
    
    LENGTH(CNTNT) DBMS_LOB.GETLENGTH(CNTNT)
    ------------- -------------------------
             3837                      3837
    

    Published by: PhoenixBai on September 24, 2009 13:40

  • How to find the size of a table with CLOB

    Hello

    I have a table with CLOB as follows:

    SQL > desc INFO_MESSAGES

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    CLNT_OID NOT NULL VARCHAR2 (16)

    USR_OID NOT NULL VARCHAR2 (16)

    LAST_client_msg_ID VARCHAR2 (36)

    LAST_client_msg_DATE DATE

    LAST_client_msg CLOB

    LAST_USR_MSG_BOD_ID VARCHAR2 (36)

    DATE OF LAST_USR_MSG_DATE

    CLOB LAST_USR_MSG

    Now I just want to find out what is the size/area total absorbed by the table (including the CLOB columns), so how can I find? I think that the usual command does not - the

    Select format from dba_segments where nom_segment = "INFO_MESSAGES" is only showing 7 MB, while I think that the table has several GB of space due to the CLOB.

    Also to add one more detail: when dba_segments seeking, I see a result like this:

    Select * of dba_segments order by bytes DESC;

    MIGRTN SYS_LOB0000111131C00008$ $ LOBSEGMENT SAMS DATA1 20690 6 1963 14528000 119013376000 <-the top row

    MIGRTN this is the schema where this INFO_MESSAGES table is present.

    Thanks,

    OrauserN

    you will need to add the segment_size of the LOB segments to the segment_size of the table. The connection between the two pieces of information you find in USER_LOBS (or the corresponding ALL_, DBA_ objects).

  • Update a table with one column of another

    Oracle 11g
    Hello

    i'im trying to update the two columns of table SUPPORT (SUPPORT_X, SUPPORT_Y) with two columns of table POST_HTA_BT (POSTHTABT_GPS_X, POSTHTABT_GPS_Y)

    Understand that the two tables have the colum below:

    SUPPORT (SUPPORT_ID, SUPPORT_PLAQUE, POSTHTABT_ID, SUPPORT_X, SUPPORT_Y,...)

    POST_HTA_BT (POSTHTABT_ID, POSTHTABT_GPS_X, POSTHTABT_GPS_Y,...)

    The SUPPORT_PLAQUE has type varachar. Except the keys, the other columns are varchar type in both tables.

    The point here is to update the support_x, support_y with posthtabt_gps_x and posthtabt_gps_y.But before the update we have Sheik if the fifth number of the support plate is a number of characters from "0" to "9"and the rest of the caracter of the support_plaque is '00000'

    Please note that the support_plaque is stored in the table with the form: "0025800000!"

    So I did the below script, I try to execute in sql develop.

    SET SERVEROUTPUT ON

    DECLARE
    chiffre_liste varchar (200): = '0 ', '1', '2', '3', '4', ' 5 ', ' 6' ', 7', ' 8 ', ' 9';
    CURSOR CUR_GPS_SUPPORT IS
    Select MEDIA. SUPPORT_X, SUPPORT. SUPPORT_Y, POSTE_HTA_BT. POSTHTABT_ID, SUPPORT. EXPL_ID,
    SUPPORTED. SUPPORT_PLAQUE, POSTHTABT_GPS_X, POSTHTABT_GPS_Y
    support,.
    POSTE_HTA_BT
    where
    SUPPORTED. SUPPORT_X IS NULL and
    SUPPORTED. SUPPORT_Y IS NULL and
    SUPPORTED. POSTHTABT_ID = POSTE_HTA_BT. POSTHTABT_ID and
    SUPPORTED. EXPL_ID = POSTE_HTA_BT. EXPL_ID
    Order of SUPPORT. POSTHTABT_ID;

    w_POSTHTABT_ID POSTE_HTA_BT. Type of POSTHTABT_ID %;
    w_SUPPORT_X SUPPORT. TYPE % SUPPORT_X;
    w_SUPPORT_Y SUPPORT. TYPE % SUPPORT_Y;
    w_EXPL_ID SUPPORT. TYPE % EXPL_ID;
    w_SUPPORT_PLAQUE SUPPORT. TYPE % SUPPORT_PLAQUE;
    w_POSTHTABT_GPS_X POSTE_HTA_BT. TYPE % POSTHTABT_GPS_X;
    w_POSTHTABT_GPS_Y POSTE_HTA_BT. TYPE % POSTHTABT_GPS_Y;

    BEGIN
    DBMS_OUTPUT. Put_line ('loading the coordoonnees GPS - GPS Coord update takes care of starting ');

    FOR HEART LOOPING CUR_GPS_SUPPORT

    w_POSTHTABT_ID: = cur. POSTHTABT_ID;
    w_SUPPORT_PLAQUE: = cur. SUPPORT_PLAQUE;
    w_SUPPORT_X: = cur. SUPPORT_X;
    w_SUPPORT_Y: = cur. SUPPORT_Y;
    w_POSTHTABT_GPS_X: = cur. POSTHTABT_GPS_X;
    w_POSTHTABT_GPS_Y: = cur. POSTHTABT_GPS_X;

    If substr (cur.support_plaque, 5, 1 chiffre_liste) and substr (cur.support_plaque, 6, 5) = '00000'
    w_SUPPORT_X: = CUR. POSTHTABT_GPS_X
    w_SUPPORT_Y: = CUR. POSTHTABT_GPS_Y
    END if;
    EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X: = NULL and w_SUPPORT_Y: = NULL;
    END;

    -Updated the table of the supports
    Update SUPPORT
    Set SUPPORT_X = w_SUPPORT_X,
    SUPPORT_Y = w_SUPPORT_Y
    where SUPPORT_PLAQUE = w_SUPPORT_PLAQUE;
    -On valid imm? immediately
    commit;
    EXCEPTION when no_data_found then null;
    -No details found
    END;

    END;
    /

    and I got the following errors:

    Error report:
    ORA-06550: line 2, colum 34:
    PLS-00103: symbol ',' met instead of one of the following symbols:

    * & = - + ; <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | submultiset of type multiset Member
    ORA-06550: line 2, column 52:
    PLS-00103: symbol ';' met instead of one of the following symbols:

    ), * & = - + <>/ is mod remains not rem = >
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | Member of multiset must
    ORA-06550: line 38, colum 48:
    PLS-00103: symbol 'CHIFFRE_LISTE' met instead of one of the following symbols:

    (
    Symbol "(" a été substitué à "CHIFFRE_LISTE" verser continuer.) "
    ORA-06550: line 39, 12 colum:
    PLS-00103: symbol 'W_SUPPORT_X' met instead of one of the following symbols:

    ), * & -+ / at rem mod < Hurst (*) > rest and or.
    multiset
    ORA-06550: line 40, 12 colum:
    PLS-00103: symbol 'W_SUPPORT_Y' met instead of one of the following symbols:

    . (), * @ % & = - + <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | mult
    ORA-06550: line 41, colum 9:
    PLS-00103: symbol 'END' met instead of one of the following symbols:

    . (), * @ % & = - + <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | multiset members
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:

    I checked the line number, but do not see the error in my code.

    Please could you help me?

    peace

    Hello

    glad to know that it worked. In fact, I don't see the reason to make these complicated processes.

    Remember the mantra:

    • If you can do it with SQL then do it with SQL

    Good evening!

    Alberto

  • Output of the coil of large table with millions of records

    Hello

    I'm trying to simply take the exit of records in a table in the text file by using the query. I get error "ORA-01841 full year should be between 4713 and 9999 and not 0" after extraction of very few records in the table.
    Here's the query I'm currently using:

    SET THE POSITION

    SET VERIFY OFF

    SET SERVEROUTPUT OFF

    TERMOUT OFF SET

    SET FEEDBACK OFF

    SET TRIMSPOOL ON

    SET LINESIZE 32000

    SET PAGESIZE 0

    SET COLSEP «|»

    Column MANDT A5 format

    Column BUKRS format A5

    Column BELNR A10 format

    Column GJAHR A5 format

    Column BLART A2 format

    Format of column BLDAT A11

    Format of column BUDAT A11

    Column MONAT A5 format

    Column CPUDT A10 format

    Column CPUTM A8 format

    Column AEDAT A10 format

    Column UPDDT A10 format

    Column WWERT A10 format

    USNAM A12 column format

    TCODE A20 column format

    Format of column BVORG A16

    Format of column XBLNR A16

    Column DBBLG A10 format

    Column STBLG A10 format

    Column STJAH A5 format

    BKTXT A25 column format

    Column WAERS format A5

    Column KURSF 999999999.99999 format

    Column KZWRS format A5

    Column KZKRS format 999999999.99999

    Column BSTAT A5 format

    Column XNETB A5 format

    FRATH 9999999999999.99 column format

    Column XRUEB A5 format

    Column GLVOR A5 format

    GRPID A12 column format

    Format of column DOKID A40

    ARCID A10 column format

    IBLAR columns A5 format

    Column AWTYP A5 format

    AWKEY A20 column format

    Column FIKRS format A5

    Column HWAER A5 format

    Column HWAE2 A5 format

    Column HWAE3 A5 format

    Column KURS2 999999999.99999 format

    Column KURS3 999999999.99999 format

    Column BASW2 A5 format

    Column BASW3 A5 format

    Column UMRD2 A5 format

    Column UMRD3 A5 format

    Column XSTOV A5 format

    Column STODT A10 format

    Column XMWST A5 format

    Column CURT2 A5 format

    Column CURT3 A5 format

    Column KUTY2 A5 format

    Column KUTY3 A5 format

    Column XSNET A5 format

    Column AUSBK A5 format

    Column XUSVR A5 format

    Column DUEFL A5 format

    Column AWSYS A10 format

    Column TXKRS format 999999999.99999

    Column LOTKZ A10 format

    Column XWVOF A5 format

    Column STGRD A5 format

    PPNAM A12 column format

    Column BRNCH A5 format

    Column NUMPG A5 format

    Column ADISC A5 format

    XREF1_HD A20 column format

    XREF2_HD A20 column format

    Column XREVERSAL A10 format

    Column REINDAT A10 format

    Column PSOTY A5 format

    Column PSOAK A10 format

    Column PSOKS A10 format

    Column PSOSG A5 format

    PSOFN A30 column format

    Column INTFORM A8 format

    Column INTDATE A10 format

    Column PSOBT A10 format

    Column PSOZL A5 format

    Column PSODT A10 format

    Column PSOTM A8 format

    Column FM_UMART A8 format

    NIEC A4 format column

    CCNUM A25 column format

    Column SSBLK A5 format

    LOT 10 column format

    SNAME A12 column format

    Column SAMPLED A8 format

    Column KNUMV A10 format

    XBLNR_ALT A26 column format

    ZZREASON_CD A12 column format

    ZZREASON_DSCRPT A50 column format

    coil bkpf.txt

    Select MANDT, BUKRS, BELNR, GJAHR, BLART, decode (' BLDAT, '00000000', ' 00.00.0000', to_char (to_date (substr (BLDAT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as BLDAT, decode ("BUDAT, '00000000', ' 00.00.0000', to_char (to_date (substr (BUDAT, 1, 10),"DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as BUDAT, MONAT, decode (' CPUDT, '00000000', ' 00.00.0000', to_char (to_date (substr (CPUDT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as CPUDT, decode (cputm, '000000','00: 00:00', to_char (substr (cputm, 1, 2) |': ': substr (cputm, 3, 2) |': ' | substr (cputm, 5, 2))) as CPUTM,
    Decode (' aedat, '00000000', ' 00.00.0000', to_char (to_date (substr (AEDAT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as AEDAT,
    Decode (' UPDDT, '00000000', ' 00.00.0000', to_char (to_date (substr (UPDDT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as UPDDT,
    Decode (' WWERT, '00000000', ' 00.00.0000', to_char (to_date (substr (WWERT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as WWERT,
    USNAM, TCODE, BVORG, XBLNR, DBBLG, STBLG, STJAH, BKTXT, WAERS, KURSF, KZWRS, KZKRS, BSTAT, XNETB, FRATH, XRUEB, GLVOR, GRPID, DOKID, PROFESSIONNAL, IBLAR, AWTYP,
    AWKEY, FIKRS, HWAER, HWAE2, HWAE3, KURS2, KURS3, BASW2, BASW3, UMRD2, UMRD3, XSTOV, decode ("STODT, '00000000', ' 00.00.0000', to_char (to_date (substr (STODT, 1, 10),"DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as STODT, XMWST, CURT2, CURT3, KUTY2,.
    KUTY3, XSNET, AUSBK, XUSVR, DUEFL, AWSYS, TXKRS, LOTKZ, XWVOF, STGRD, PPNAM, BRNCH, NUMPG, ADISC, XREF1_HD, XREF2_HD, XREVERSAL,
    Decode (' REINDAT, '00000000', ' 00.00.0000', to_char (to_date (substr (REINDAT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as REINDAT, PSOTY, PSOAK, PSOKS, PSOSG, PSOFN, INTFORM, decode ("INTDATE, '00000000', ' 00.00.0000', to_char (to_date (substr (INTDATE, 1, 10),"DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as INTDATE,.
    Decode (' PSOBT, '00000000', ' 00.00.0000', to_char (to_date (substr (PSOBT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as PSOBT, PSOZL,.
    Decode (' PSODT, '00000000', ' 00.00.0000', to_char (to_date (substr (PSODT, 1, 10), "DD-MM-RRRR"),' JJ.)) Messrs. RRRR')) as PSODT, decode (PSOTM, '000000','00: 00:00', to_char (substr (PSOTM, 1, 2) |': ' | substr (PSOTM, 3, 2) |': ': substr (PSOTM, 5, 2))) as PSOTM, FM_UMART, NIEC,.
    CCNUM, SSBLK, BATCH, SNAME, SAMPLED, KNUMV, XBLNR_ALT, ZZREASON_CD, ZZREASON_DSCRPT from sapsrp.bkpf where mandt = 200;

    spool off

    Please suggest what Miss me in this area, so that I can extract all records from this table.


    Thank you
    Manish

    >
    This issue is that all of these columns are to the date format, but when I try to extract data from these columns it comes like 20120606 (YYYYMMDD) while I need my output as DD. MM YYYY.

    I used decode only to convert values to these fields in these columns, where the date was not entered and therefore containing 00000000.
    >
    This is simply not true. Did you read my response? You use "substr (BLDAT, 1, 10)" - so how can you say "the data in those columns happen like 20120606' which is only 8 characters long? Which does not match what you just said.

    Also, as I said before, if you have data in BLDAT that contains ' 00000000' and then to the ' to_date (substr (BLDAT, 1, 10),...). ' throw an exception because you try to convert the 8 zeros of a date. This is the problem that you are experiencing.

    BLDAT contains a string that is a valid date, or it doesn't.

    You continue this problem posed by the same if you copy values such as "00.00.0000" as these will cause an exception when you attempt to convert their return at a date each time that data are used.

    If you have at least two problems with BLDAT and the other two that I mentioned.

    1. the data in the column are 8 characters or 10 length may not be both - use you 8 in the decoding and 10 in the substr

    2. the data is either a string representing a date is valid or not.

    If all values are "00000000" or a string such as "YYYYMMDD" then you need to use a decoding that creates ' 00.00.0000 "' if the value is '00000000' or makes a TO_DATE (BLDAT, 'YYYYMMDD'). In only one of the two values will be issued. Now you're different columns show two for BLDAT.

    Suggest that experiment you with a simple query that contains only BLDAT until you get the process worked on how get the result without errors. Then expand the query to include other columns.

    Keep it simple until it works.

  • Update of table with 14 million records

    good day, I'm updating a table with 14 million documents column. using the data from another table.
    This takes terrible time just updated to 500,000 over the weekend, which is unacceptable.
    ideas to improve my code and get the fastest update is much appreciated.

    DECLARE
    TYPE vc_type is table of index varchar2 (20) by pls_integer;
    type tabtype_rowid is table of pls_integer rowid indexes;
    my_cur sys_refcursor;
    cur_limit integer: = 10000;

    tab_rowid tabtype_rowid;

    Start
    OPEN FOR My_cur
    SELECT value, rowid
    TABLE 1A

    where the value IS NOT NULL
    and id is null;


    loop
    collect the fetch my_cur in bulk in tab_value, cur_limit limit tab_rowid;

    FORALL k IN 1.tab_npi.count

    UPDATE table 1A
    A.ID = (select id SET
    in Table 2b
    where value = tab_value (k)
    and rownum = 1
    )
    WHERE a.rowid = tab_rowid (k);

    COMMIT;

    When the output tab_value.count < cur_limit;.
    end loop;

    END;


    Thank you

    903537 wrote:
    I tried to update basic training, as a first step and it crashed...

    He didn't fail, it failed.

  • Copy the table with data and constraints

    Hi all

    I need to create a stored procedure that creates a table and copy a table with its data and constraints. We use it for backups. Y at - it all stored procedures out there who can do it, im pretty new to this and I need to create a stored procedure that can achieve this.

    any help will be much appreciated

    Thank you
    K

    Hello

    The procedure that you created is invalid

    Recompile it, and then type

    show error
    

    Rectivy the error until the procedure becomes valid.

    Concerning
    Anurag

  • ? Work with clob and blob - using Dbms_Lob

    I need to look into a blob and to delete some data, but having problems to work on dbms_lob.erase.
    Reading the documentation, the procedure is supposed to work with BLOB or CLOB, but I can't make it work with the blob.

    Here's what I coded and it does not work for blobs.

    What I've done wrong?
    declare
    v_start                   integer;
    v_stop                    integer;
    v_amount                  integer;
    v_max_len                  integer:=32676;
    v_offset                   integer:=1;
    v_new_length               integer;
    
    v_clob clob;
    v_blob blob;
    
    begin
    
     update test_clob
     set clob_id = clob_id
     where clob_id = 1
     returning clob_desc into v_clob;
    
     v_start := 0;
     v_stop  := 0;
     v_amount := 0;
     
     v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
     v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
     v_amount := ((v_stop - v_start)+11) ;
    
     dbms_output.put_line('Clob: '||v_clob);
     
     dbms_lob.erase(v_clob, v_amount, v_start);
    
     dbms_output.put_line('Clob: '||v_clob);
     
     rollback; 
     
     update test_clob
     set clob_id = clob_id
     where clob_id = 1
     returning blob_desc into v_blob;
    
     v_start := 0;
     v_stop  := 0;
     v_amount := 0;
    
     v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
     v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
     v_amount := ((v_stop - v_start)+11) ;
    
     dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    
     dbms_lob.erase(v_blob, v_amount, v_start);
    
     dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
     
     rollback;
     
    end trg_bui_user_assoc_layout;
    /
    This is the output
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test 

    Well, you left out the DDL table and your insert for the sample data (would be nice to have) as well as your version of Oracle (practically a necessity).

    Since I had to make my own that there could be a difference in how you filled your table, but I can not reproduce your findings.

    ME_ORCL?drop table test_clob purge;
    
    Table dropped.
    
    Elapsed: 00:00:00.09
    ME_ORCL?
    ME_ORCL?create table test_clob
      2  (
      3     clob_id     number not null primary key,
      4     clob_desc   clob,
      5     blob_desc   blob
      6  );
    
    Table created.
    
    Elapsed: 00:00:00.03
    ME_ORCL?
    ME_ORCL?insert into test_clob values
      2  (
      3        1
      4     ,  'this is only a test SortMode  should leave this alone'
      5     ,  utl_raw.cast_to_raw('this is only a test SortMode  should leave this alone')
      6  );
    
    1 row created.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?commit;
    
    Commit complete.
    
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?declare
      2  v_start                   integer;
      3  v_stop                    integer;
      4  v_amount                  integer;
      5  v_max_len                  integer:=32676;
      6  v_offset                   integer:=1;
      7  v_new_length               integer;
      8
      9  v_clob clob;
     10  v_blob blob;
     11
     12  begin
     13
     14   update test_clob
     15   set clob_id = clob_id
     16   where clob_id = 1
     17   returning clob_desc into v_clob;
     18
     19   v_start := 0;
     20   v_stop  := 0;
     21   v_amount := 0;
     22
     23   v_start := dbms_lob.instr(v_clob, 'SortMode', v_offset );
     24   v_stop  := dbms_lob.instr(v_clob, '',  v_start );
     25   v_amount := ((v_stop - v_start)+11) ;
     26
     27   dbms_output.put_line('Clob: '||v_clob);
     28
     29   dbms_lob.erase(v_clob, v_amount, v_start);
     30
     31   dbms_output.put_line('Clob: '||v_clob);
     32
     33   rollback;
     34
     35   update test_clob
     36   set clob_id = clob_id
     37   where clob_id = 1
     38   returning blob_desc into v_blob;
     39
     40   v_start := 0;
     41   v_stop  := 0;
     42   v_amount := 0;
     43
     44   v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('SortMode'), v_offset );
     45   v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw(''),  v_start );
     46   v_amount := ((v_stop - v_start)+11) ;
     47
     48   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
     49
     50   dbms_lob.erase(v_blob, v_amount, v_start);
     51
     52   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
     53
     54   rollback;
     55
     56  end trg_bui_user_assoc_layout;
     57  /
    Clob: this is only a test SortMode  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test SortMode  should leave this alone
    Blob: this is only a test                                            should leave this alone
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.03
    ME_ORCL?select *
      2  from v$version;
    
    BANNER
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    
    5 rows selected.
    
    Elapsed: 00:00:00.03
    ME_ORCL?
    
  • Transmission of data in a table with loop and case

    Hi all, I'm Felix and new to labview.

    I am currently on a certain data editing project. I have some data (Spectra taken in different times) in a .lvm file which needs a Gaussian fit and I would like to have the characteristics of adjustment to a 2D array, so I can trace the amplitude, time vs Center and width.

    My problem is that my final picture is a 2d one and made it gives me 1 d.

    Can you please help me to solve this problem.

    Thank you

    Felix

    Hi felixd,

    According to my understanding, your problem is in the construction of the matrix. Instead of spending items in the funcion with a 2D table array construction, you can initially built a 1 d array elements and then include her in a 2D array using another feature of table construction. Check the attached vi.

    Concerning

    Amine31

    (Give congratulations to good answers and Mark as a Solution If your problem is resolved)

  • Possible bug: save the table with double and extended precision to the worksheet

    If one concatenates an array of double-precision and an array of precision extended with the 'build' vi table, then recorded using 'Write in a spreadsheet file' vi any digits to the right of the decimal are reset to zero in the saved file. Regardless of the entry of signifier of format (for example %.10f) to the vi 'Write in a spreadsheet file'.

    I'm on Vista Ultimate 32 bit and labview 9.0

    This is a possible bug that is easily circumvented by the conversion of a type before you incorporate arrar in a worksheet. Nevertheless, it's a bug and it cost me some time.

    Hi JL,.

    No, this is not a bug - it's a feature

    Well, if you'd look closer you would recognize the 'save to spreadsheet' as polymorphic VI. As this polymorphic VI does not support the EXTENSION numbers internally (it only supports DBL, I64, and String) LabVIEW selects the instance with more precision: I64 (I64 a 64 bits of precision, DBL that 53...). Your options are:

    -the value of the instance to use as the DBL (by right click and "Select type... »)

    -make a copy of this VI, save it under a different name and make support number of POST (not rework the polymorphic VI like you would break compatibility with other facilities of LV or future revisions)

  • call a script sql with one parameter of another

    I would like to call a sql script that takes a single parameter (& 1)... but it doesn't.
    It looks like (first.sql):
    begin
    for cv in (select table_name from all_tables where owner='IBIS') loop
            @my_script.sql cv.table_name;
    end loop;
    end;
    but when I run it, I got an error:
    @first.sql;
    old   9: spool &1..cob replace
    new   9: spool cv.table_name.cob replace
    old  10: select '       05 DBUFF-' || '&1' || '-1.' from dual;
    new  10: select '       05 DBUFF-' || 'cv.table_name' || '-1.' from dual;
    old  12: from all_tab_cols where table_name='&1' and substr(column_name,1,3)<>'SYS';
    new  12: from all_tab_cols where table_name='cv.table_name' and substr(column_name,1,3)<>'SYS';
    old  13: select '          05 ' || '&1' || '-ROWID          PIC X(18).' from dual;
    new  13: select '          05 ' || 'cv.table_name' || '-ROWID          PIC X(18).' from dual;
    What is missing?

    Kind regards...

    Hello

    The trick is to generate a sql script with all your calls to internal scripts and their parameters.

    For example, my script is internal countTableIndex.sql :

    select 'Table &1 has got '||count(*)||' indexes.' from user_indexes where table_name='&1';
    

    And here's my script outside coutnIndex.sql :

    set serverout on pages 0 lines 100 feed off time off verify off define on tab off trimspool on trimout on termout on termout off
    spool cmd.sql
    begin
    for cur in (select table_name tab from user_tables) loop
         dbms_output.put_line('@countTableIndexes.sql '||cur.tab);
         null;
    end loop;
    end;
    /
    spool off
    set termout on
    @cmd.sql
    exit;
    

    As you can see, it generates a file cmd.sql containing internal script calls and ultimately calls the script cmd.sql.
    In my example schema scott after the execution, the cmd.sql file contains:

    @countTableIndexes.sql DEPT
    @countTableIndexes.sql EMP
    @countTableIndexes.sql BONUS
    @countTableIndexes.sql SALGRADE
    @countTableIndexes.sql TOTO
    

    Here is the result of my machine:

    [oracle@Nicosa-oel test19_parameterizedSqlScripts]$ sqlplus -s scott/tiger@my11g @countIndex.sql
    Table DEPT has got 1 indexes.
    Table EMP has got 1 indexes.
    Table BONUS has got 0 indexes.
    Table SALGRADE has got 0 indexes.
    Table TOTO has got 0 indexes.
    
  • Update multiple rows in a table with one value of another multiple

    Using SQL Server

    How this can be done:

    In all the lines in the upper table PS_CA_BILL_PLAN, we want to update the field LAST_XREF_SEQ_NUM with the MAX (XREF_SEQ_NUM) + 1 of the bottom table

    Where the CONTRACT_NUM and the BILL_PLAN_ID are equal

    This SQL below (in green) works for one line only

    SQL.jpg

    I think it's the SQL code you're looking for:

    UPDATE PS_CA_BILL_PLAN SET LAST_XREF_SEQ_NUM =

    (SELECT MAX (XREF_SEQ_NUM) + PS_CA_BP_XREF 1 B)

    WHERE B.CONTRACT_NUM = A.CONTRACT_NUM AND B.BILL_PLAN_ID = A.BILL_PLAN_ID)

  • Count on a table with header and row data in the query

    Hello

    I have an obligation to prepare a report that shows the metrics on the provider. I need to find the total PO for this provider, which fit the Bill

    report must be mealgne of #ofpo, #invoice, total_inv_amt and total_po_amt, total_tax_amt with numbers also with the point in time. So my question is how do we achieve this I have this below query that gives all the data but do not know how to get the counties with that. All ideas

    SELECT hou.name,
    POV. $VENDOR_NAME,
    API.invoice_num,
    API.invoice_id,
    invoice_date,
    gl_date,
    API.invoice_currency_code,
    APID.line_type_lookup_code inv_line_type,
    APID. Description inv_description,
    APID.amount,
    APID.unit_price inv_price,
    amount_paid,
    apt. Name payment_terms,
    payment_status_flag,
    APC.check_number,
    APC.check_date,
    Poh.Segment1 po_num,
    Poh.CREATION_DATE po_creation_date,
    por. CREATION_DATE po_rel_creation_date,
    por.release_num,
    pol.line_num,
    MC. Segment1 category_name,
    (select item_num msi.segment1
    MSI inv.mtl_system_items_b
    where msi.inventory_item_id = pol.item_id
    and msi.organization_id = 1) item_num.
    pol.item_description po_item_description,
    Poll.need_by_date,
    pol.unit_price po_price,
    Poll.Quantity,
    Poll.quantity_cancelled,
    Poll.quantity_received,
    Poll.quantity_billed
    OF api ap.ap_invoices_all,.
    Hou hr_operating_units,.
    apt, ap_terms_tl
    AP.ap_invoice_distributions_all apid,
    pod po.po_distributions_all,
    Po.po_vendors pov,
    Po.po_headers_all poh,
    Po.po_lines_all pol,
    survey of po.po_line_locations_all,
    por po.po_releases_all,
    AP.ap_checks_all apc,
    AP.ap_invoice_payments_all IPA,
    -inv.mtl_system_items_b msi,
    Apps.mtl_categories_b mc
    WHERE apt.term_id = api.terms_id
    AND hou.organization_id = api.org_id
    AND BETWEEN TRUNC (poh.creation_date): p_start_date AND: p_end_date
    AND api.invoice_id = apid.invoice_id
    AND apid.po_distribution_id = pod.po_distribution_id (+)
    AND pov.vendor_id = api.vendor_id
    AND poh.po_header_id (+) = pod.po_header_id
    AND poll.line_location_id (+) = pod.line_location_id
    AND pol.po_line_id (+) = pod.po_line_id
    AND apip.check_id = apc.check_id (+)
    AND apip.invoice_id (+) = api.invoice_id
    AND mc.category_id (+) = pol.category_id
    AND por.po_release_id (+) = pod.po_release_id
    AND pov.vendor_id = 1

    Hello

    Her looks like a job for the COUNT function. That's all I can say with certainty based on the information you gave.

    If you want to see on each line of output, the number of rows with the same value of api.invoice_num has a value for poh.po_header_id, you can use

    COUNT (poh.po_header_id) OVER (PARTITION BY api.invoice_num)   AS po_cnt
    

    I could give much better directions if you could post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data. I realize it's hard with so many pictures. To see some of your courses and the desired output, could help.

  • SQL Query to retrieve records in a table with the same records or only one record in a table

    Hello

    Got a curious requirment to extract the Non-distincts records in a table

    Example of

    Account number Type of account
    12345SB
    12345

    SB

    12346CR
    12346SB
    12347SB
    12348CR
    12349SB

    Requrirement is to retrieve the records as follows

    Result must be

    Account number Type of account
    12345SB
    12345

    SB

    12347SB
    12348CR
    12349SB

    You will notice that 12346 which has two separate lines have been eliminated in the result. I tried several qeries to achieve this result, one or the other had a few mismatch. Can someone give me a request for it.

    Thanks in advance.

    SELECT ACCOUNT_NUMBER,

    ACCOUNT_TYPE

    DE)

    SELECT ACCOUNT_NUMBER,

    ACCOUNT_TYPE,

    COUNT (*) ON CNT_ACC (ACCOUNT_NUMBER PARTITION).

    COUNT (*) ON CNT_NUM_TYP (PARTITION ACCOUNT_NUMBER, ACCOUNT_TYPE)

    FROM T1)

    WHERE CNT_ACC = CNT_NUM_TYP;

    exit;

    12345 SB
    12345 SB
    12347 SB
    12348 CR
    12349 SB
  • get the table script using dbms_metadata.get_ddl but with clob field

    Thus, Oracle 11g R2...
    I use dbms_metadata.get_ddl for table scripts and it works fine...

    now, I have a table with clob field, and it does not work... I got an error "missing a closing parenthesis (ora-0907) '...
    I could paste a script I had, but I don't think that it makes no sense...

    does anyone have an experience on the use of this package on clob tables?


    TNX

    See this code.

    DECLARE
      myddl clob;
      PROCEDURE print_clob(p_clob in clob) as
        l_offset number default 1;
      BEGIN
        loop
          exit when l_offset > dbms_lob.getlength(p_clob);
          dbms_output.put_line(dbms_lob.substr(p_clob, 255, l_offset));
          l_offset := l_offset + 255;
        end loop;
      END print_clob;
      FUNCTION get_metadata return clob is
        h   number;
        th  number;
        doc clob;
      BEGIN
        h := dbms_metadata.open('TABLE');
        dbms_metadata.set_filter(h, 'SCHEMA', 'HR');
        dbms_metadata.set_filter(h, 'NAME', 'EMPLOYEES');
        th := dbms_metadata.add_transform(h, 'MODIFY');
        th := dbms_metadata.add_transform(h, 'DDL');
        --dbms_metadata.set_transform_param(th,'SEGMENT_ATTRIBUTES',false);
        doc := dbms_metadata.fetch_clob(h);
        dbms_metadata.CLOSE(h);
        return doc;
      END get_metadata;
    BEGIN
      myddl := get_metadata;
      print_clob(myddl);
    END;
    

    This procedure of print_ddl I took of the documentation.
    Use of the long VALUE. See, in the first example out put is truncated.

    SQL> SELECT dbms_metadata.get_ddl('TABLE','EMP','SCOTT') FROM dual;
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
    
    SQL> set long 10000
    SQL> /
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    
    SQL> SET LINESIZE 132
    SQL> SET pagesize 0
    SQL> SET LONG 1000000
    SQL> /
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    
    SQL>
    

Maybe you are looking for

  • I'm loading .mbx file in my directory of files C:\Users\Marylfletcher\AppData\Roaming\Thunderbird\Profiles\etmnp0du.default\Mail\Local. and I can't see message

    I'm loading .mbx file in my directory of files C:\Users\Marylfletcher\AppData\Roaming\Thunderbird\Profiles\etmnp0du.default\Mail\Local. In some cases, I'm not able to see the message. I need help on troubleshooting. As it is a stop for my team and my

  • was afraid that this would happen and he did

    so last night I noticed my iphone was not the case around, I was home all day so I wasn't worried, I just got online & open icloud it was great they needed me to update my profile & choose 3 responses to security issues. then you connect again and an

  • El capitan mail will send personal photos by itself

    After the upgrade to El Capitan, my mail will add a picture of my library to my messages, without my consent. I checked in the mail preferably: 'add pictures' is not checked. I have a Mac I mid-2007. El Capitan works well for other features. How can

  • The volume control has dissapered

    Today, I noticed that the volume control in the toolbar on the lower right corner of my screen has dissapered. I right click and click on properties and under the "notification area" the little box for the volume cannot be clicked. If anyone can help

  • ListView refreshing

    Hello I work with ListView to display a list of contacts, some online and offline. I want contacts who are online to appear at the top of my list, and they might come online later so that they will be put to the top of the list, if they come online l