Error (21,100): PL/SQL: ORA-00997: illegal use of the LONG data type

CREATE or REPLACE (name in varchar2) procedure Compress_tab_partition
is
last_mnth_var varchar2 (8);
curr_mnth_var varchar2 (8);
number of last_mnth;
number of curr_mnth;
last_partition varchar2 (8);
high_val varchar2 (4000);
Start

Select to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00' in the double last_mnth_var;
Select to_char (sysdate, 'YYYY') | TO_CHAR (sysdate, 'mm') | ' 00' in the double curr_mnth_var;
Select to_number (last_mnth_var) in the double last_mnth;
Select to_number (curr_mnth_var) in the double curr_mnth;

Dbms_output.put_line ('Compression of GOLDMGR Table scores.' | table-name |) "to go". ») ;
Dbms_output.put_line(' ');

/ * Step 1 - identify the name of the partition of the specified table must be compressed * /.
Select high_value from high_val from user_tab_partitions where table_name = table-name;
Select nom_partition into last_partition from user_tab_partitions where table_name = table-name and high_value = rtrim (high_val);

/ * Step 2 - Alter partition table to compress * /.

run immediately "ALTER TABLE GOLDMGR." | table_name | ' CHANGE THE PARTITION '. last_partition | "COMPRESS by low query";

/ * Step 3 - Index rebuild step * /.

I'm in (select index_name in user_indexes where table_name = table-name)
loop
run immediately "ALTER INDEX GOLDMGR." | i.index_name |' REBUILD ";
end loop;

Dbms_output.put_line (' COMPLETED: compress the Table partitions change.) ") ;

end;
/

I'm getting an error like: Error (21,100): PL/SQL: ORA-00997: illegal use of the LONG data type

Please resolve.

HIGH_VALUE datatype is LONG. You may not use for a long TIME in WHERE clause expressions. You need to loop through the partitions by selecting HIGH_VALUE and then comparing. Secondly, there is no need to select double to calculate expressions. For example:

Select to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00' in the double last_mnth_var;

should be replaced by

last_mnth_var: = to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00'.

and there is no need to add_months here:

last_mnth_var: = to_char (trunc (sysdate, 'MM') - 1, "YYYYMM"). ' 00'.

But the main question is simply ALTER TABLE MODIFY PARTITION COMPRESS allows compression but does not compress. You must issue ALTER TABLE MOVE PARTITION COMPRESS:

SQL > create table tbl (n) partition by range (n)
2 (partition p1 values less than (maxvalue))
3. Select lpad('X',4000,'X') from dual connect by level<=>
4.

Table created.

SQL > select bytes
2 from WHERE user_segments
3 where nom_segment = 'TBL '.
4 and nom_partition = 'P1 '.
5.

BYTES
----------
830472192

SQL > alter table tbl
2. change the partition p1 compress
3.

Modified table.

SQL > select bytes
2 from WHERE user_segments
3 where nom_segment = 'TBL '.
4 and nom_partition = 'P1 '.
5.

BYTES
----------
830472192

SQL > alter table tbl
2. move the partition p1 compress
3.

Modified table.

SQL > select bytes
2 from WHERE user_segments
3 where nom_segment = 'TBL '.
4 and nom_partition = 'P1 '.
5.

BYTES
----------
8388608

SQL >

SY.

Tags: Database

Similar Questions

  • ORA-00997: illegal use of the LONG data type

    Hi all

    11.2.0.1

    ALTER TABLE SAFDB MOVE TABLESPACE DATA_TS_ENC

    *

    ERROR on line 1:

    ORA-00997: illegal use of the LONG data type

    Why illegal? How can I move this table?

    Thank you very much

    pK

    Take a look who

    http://aprakash.WordPress.com/2011/01/06/how-to-move-table-containing-long-or-LOB-columns/

    Concerning

  • ORA - 00997 illegal use of Long Datatype meets she no Long

    I have a query that worked very well for years. We have upgraded to 10.2.0.5 on a test instance and we now get this error.

    The view in the FROM clause is a specific view of the org on xxc_affi_relation_headers_all. All fields of the view and the underlying table are VARCHAR2, NUMBER, or DATE.


    I've simplified the request to that still gives the error.
    The query is:
    SELECT *.
    OF xxc_affi_relation_headers xarh
    WHERE xarh.affi_relation_id = (select xarh.affi_relation_id
    of xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = 125
    Connect prior xarh.affi_relation_id = xarh.parent_relation_id
    Start with xarh.affi_relation_id = 214
    );


    If I run the query sub by itself, as below, there is no error and the result is 214.
    Select xarh.affi_relation_id
    of xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = 125
    Connect prior xarh.affi_relation_id = xarh.parent_relation_id
    Start with xarh.affi_relation_id = 214

    If I run the main query and replace the query sub with 214, as below, thre is no mistake.

    Is there something that would cause an implicit conversion of a LONG data type in this query? I'm not able to find a reason for this error message that corresponds to the query.

    The original request that caused the error was:
    SELECT xarh.affi_relation_id
    Of
    xxc_affi_relation_headers xarh
    If NOT EXISTS (SELECT 1 FROM xxc_oe_order_line_dist xold
    WHERE xold.line_id = p_line_id AND xold.dist_type = 'I '.
    AND xold.affi_relation_id = xarh.affi_relation_id) - 1704
    AND v_creation_date
    BETWEEN NVL(xarh.start_date,v_creation_date-1) AND NVL (xarh.end_date, v_creation_date + 1) - AIN'T no difficulty one month valid
    AND xarh.sale_segment1 = (SELECT gcco.segment1 - RT 9631
    Of oe_transaction_types_all otty, ra_cust_trx_types_all, gl_code_combinations gcco rctt
    WHERE otty.transaction_type_id = p_order_type_id
    AND otty.cust_trx_type_id = rctt.cust_trx_type_id
    AND rctt.gl_id_rev = gcco.code_combination_id)
    AND EXISTS (SELECT 1 FROM xxc_affi_relation_lines xarl WHERE xarl.affi_relation_id = xarh.affi_relation_id
    AND NVL (xarl.element_value, v_item_type) = v_item_type)
    Connect prior xarh.parent_relation_id = xarh.affi_relation_id
    Start by
    xarh.affi_relation_id = (select xarh.affi_relation_id
    of xxc_affi_relation_headers xarh
    where xarh.execute_vendor_id = p_vendor_id
    AND xarh.affi_relation_id! = p_parent_relation_id
    AND NOT EXISTS (SELECT 1 FROM xxc_affi_relation_headers xarh2
    WHERE xarh2.parent_relation_id = xarh.affi_relation_id)
    AND v_creation_date BETWEEN NVL(xarh.start_date,v_creation_date-1) AND NVL (xarh.end_date, v_creation_date + 1) - AIN'T no difficulty one month valid
    Start with xarh.affi_relation_id = p_parent_relation_id
    Connect prior xarh.affi_relation_id = xarh.parent_relation_id)
    -ORDER OF NVL(parent_relation_id,-1), NVL2 (xarl.element_value, 1, 2)
    ;

    Its a bug

    See this Document Oracle

    Bug 9726739 - ORA-997 of SQL with CONNECT the UNION and BY [ID 9726739.8]

    Best regards

    mseberg

  • ORA-01790 Expression must have the same data type

    select  'sal' as A, sal as B, sal as C, sal as D
    from
    (Select sum(sal) sal from emp)
    union all
    select
      'comm', comm, comm, comm
    from
    (Select sum(comm) comm from emp)
    union all
    select rpad('-',10,'-') ,rpad('-',10,'-'),rpad('-',10,'-'),rpad('-',10,'-') from emp;
    Get the following error when you run the above query. I know it's because of the rpad('-',10,'-') what is the best way to achieve the expected results

    I would like to have the result with underscore. What is the best way to achieve this.

    Expected results:
    I am developing report.
    I need to have the following oupput.
    How can I put underscore after the recordings.
     A              B        C             D        
    sal         29025       29025     29025
    comm     2200    2200     2200
    --------------------------------------------------
    SQL> select  'sal' as A, sal as B, sal as C, sal as D
      2  from
      3  (Select sum(sal) sal from emp)
      4  union all
      5  select
      6    'comm', comm, comm, comm
      7  from
      8  (Select sum(comm) comm from emp)
      9  union all
     10  select rpad('-',10,'-') ,rpad('-',10,'-'),rpad('-',10,'-'),rpad('-',10,'-') from emp;
      'comm', comm, comm, comm
              *
    ERROR at line 6:
    ORA-01790: expression must have same datatype as corresponding expression
    
    SQL> select  'sal' as A, to_char(sal) as B, to_char(sal) as C, to_char(sal) as D
      2  from
      3  (Select sum(sal) sal from emp)
      4  union all
      5  select
      6    'comm', to_char(comm), to_char(comm), to_char(comm)
      7  from
      8  (Select sum(comm) comm from emp)
      9  union all
     10  select rpad('-',10,'-') ,rpad('-',10,'-'),rpad('-',10,'-'),rpad('-',10,'-') from emp;
    
    A          B                                        C                                        D
    ---------- ---------------------------------------- ---------------------------------------- ------------------
    sal        29025                                    29025                                    29025
    comm       2200                                     2200                                     2200
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    
    A          B                                        C                                        D
    ---------- ---------------------------------------- ---------------------------------------- ------------------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    ---------- ----------                               ----------                               ----------
    
    16 rows selected.
    
    SQL> 
    

    SY.

  • long data type error

    Hi all

    Hope all are fine, I got stuck in a query, and I need your help, I will be grateful for this.

    I was using the query below to copy all the data of table x to y.

    SQL > insert y select * from x@dblnkname;

    ERROR on line 1:

    ORA-00997: illegal use of the LONG data type

    I m getting the error above, tables x and there does not "long" datatype.your help will be appreciated, thanks in advance.

    DB: 11.2.0.3

    OS: RHEL 6.1

    Thank you

    Kind regards.

    copy of user/password@sid to user1/password@sid add user1.new_table using select * from user.old_table;

  • Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Hi all

    11.2.0.3.10

    AIX6

    I was installing store_procedures on our PROD several times, and they are successful. This stored_procedures are created by developers and once tested on DEV & UAT, they are transferred to the PROD through me.

    But this time I install a new SP, but I got error > Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Even if the synonym. The owner of the schema of the SP has grant select on the table and synonym of created. Why not MS can see this synonym?

    Is there something that I missed?

    Help, please... I'm going crazy

    Thank you all,

    MK

    Since there is only one user in your role, so I'll suggest to directly grant you the user rather than role - it's the easiest and simplest account according to your needs. The roles are best used to organize all of the users. If ever it is necessary to use roles (i.e. multiple users/schemas in a role) then, I think, you can play with AUTHID clause creating blocks.

  • Error (20.22): PL/SQL: ORA-00942: table or view does not exist

    I get currently getting an error when I try and insert into a table of a different pattern of my stored procedure:
    Error (20.22): PL/SQL: ORA-00942: table or view does not exist

    I am explicitly calling the table with the name of the schema that is infront

    INSERT INTO SAPSR3. ZTREC_NAME_TYPE
    (
    MASTER_ID,
    NAME_TYPE,
    FAMILY_NAME,
    FIRST NAME,
    MIDDLE_NAME,
    TITLE
    )
    VALUES
    (
    In_MasterID,
    In_NameType,
    In_FamilyName,
    In_FirstName,
    In_MiddleName,
    In_Title
    );

    Only, I get this error when I try to compile my stored procedure. If I try this insert not within a stored procedure (for example, an empty script) it works perfectly.

    Can someone tell me what Im doing wrong?

    Thank you.

    Hello

    Looks like you (the owner of the procedure) have privileges on that table only through a role.
    Roles do not count in the stored procedures created with AUTHID OWNER (which is the default).

    Or the other
    (1) user SAPSR3 have the privileges needed directly at you (or public), or
    (2) change the procedure so that it runs with the privileges of the caller, adding AUTHID CURRENT_USER after the list of arguments, but before the keyword IS (AS os) like this:

    CREATE OR REPLACE PROCEDURE     foo
    (     x     IN     NUMBER
    )
    AUTHID CURRENT_USER
    IS ...
    
  • ORA 38818: Illegal reference to the object as

    Hi people,

    In our environment 12.2, we try to create MATERIALIZED view and we receive, "ORA 38818: Illegal reference to the object as APPS.abc.

    We already recorded our custom pattern by Doc-ID 1929668.1 .

    Kind regards

    Ali

    Hello Ali,.

    Please see below the reference document, it can be useful.

    ORA-38818: Mention illegal as object when creating materialized view (Doc ID 1556379.1)

    1.4.2.5 appearing in the following Document:

    Develop and deploy customizations in Oracle E-Business Suite version 12.2 (Doc ID 1577661.1)

    -Coco

  • Error in the Primavera Analytics 3.1 (staretl issuance of long data type error)

    Hello

    When executing ETL for analytics Primavera 3.1 I am faced with long data type error.

    Session detailed log can be found on the below URL.

    http://pastebin.com/Ez0VihGN

    I have following environment.

    Primavera analytics on Win2k8 64-bit with 11g R2 DB.

    EPPM Primavera DB on Sql Server

    Connectivity via Oracle Gateway. (tested)

    Help, please.

    Naeem Akhtar

    Published by: Naeem Akhtar Khan on April 9, 2013 03:58

    Based on your post there is an error in you initdg4msl.ora file... Make sure you the database connection is correct and you add the statement two to the file

    for example

    Should be: HS_FDS_CONNECT_INFO = YOURSQLSERVER / / YOUR DATABASE

    Make sure that you add the following code in the same file (see page 92):
    HS_NLS_LENGTH_SEMANTICS = CHAR
    HS_FDS_CHARACTER_SEMANTICS = TRUE
    HS_KEEP_REMOTE_COLUMN_SIZE = ALL

    Restart the ETL process

  • ORA-02327: cannot create indexes on the LOB data type expression

    DB 10.2.0.4
    DB 5.2

    I am not able to move lobindex and lobsegment. While try occurs below error

    SQL > ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD THE TABLESPACE DATA_TEMP;
    ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD TABLESPACE DATA_TEMP
    *
    ERROR on line 1:
    ORA-02327: cannot create indexes on the LOB data type expression

    Thank you

    Published by: user13382934 on October 16, 2012 14:05

    correct syntax is
    ALTER TABLE.

    MOVE the LOB ()
    STORE AS (tablespace );

    Where is a name of the / columns LOB, not the name of the segment. Moving type LOB data will move its indexes as well.

  • ORA-01436: CONNECT loop in the user data

    Hello

    I have a simple bit of SQL out details on HR supervisor strings in Oracle EBS:
    SELECT     LPAD(' ', (LEVEL - 1) * 10, ' ') || person_id level_label
             , LEVEL
             , description
          FROM applsys.fnd_user u
             , hr.per_all_assignments_f h
         WHERE u.employee_id = h.person_id
    START WITH SYSDATE BETWEEN effective_start_date AND effective_end_date
           AND person_id = :personid
    CONNECT BY PRIOR person_id = supervisor_id
           AND SYSDATE BETWEEN effective_start_date AND effective_end_date
    It will return data normally without problems - e.g. data dummy below - looks very good. The names and made up person_ids.
    LEVEL_LABEL                    LEVEL     DESCRIPTION
    000001                         1     Person Person 1
              000002               2     Harry Marry
                        000003          3     John Smith
                                  000004     4     Jenna Jones
                                  000005     4     Her Name
                                  000006     4     His Name
                                  000007     4     Joseph Coat
                                  000008     4     Les Miserables
                        000009          3     Mister Smith
                        000010          3     Miss Jones
                        000011          3     Andrew And
                                  000012     4     Claire So
                                  000013     4     Hilary Hi
              000014               2     Jenny Jones
                        000015          3     Amanda Mandy
                                  000016     4     James Jim
                                  000017     4     William Wonder
                                  000018     4     Crazy Cat
                                  000019     4     Silly Cat
                                  000020     4     Tall Hill
                                  000021     4     Amazing Grace
                        000022          3     Lovely Mountain
                                  000023     4     Joyous Spring
                                  000024     4     Anonymous Name
                                  000025     4     Brian Binky
    However, if I try for an another person_id, for which a user receives an error in one part of the Oracle EBS, I get this error:

    ORA-01436: CONNECT loop in the user data

    I'm guessing there is a loop of supervisor happening somewhere, but I don't know how to determine where it might happen.

    I was wondering if there is any way I can change the SQL code to be able to work out where the loop can be, as there are about 50 people involved in Ministry to this user and I have been through all their records and can not see a loop to look through the Oracle HR screens.

    I know it's a 'big ask' to ask a vague question about some oracle SQL, so apologies for that.

    Any advice much appreciated.

    Thank you

    Hello

    To see loops, do something like this:

    SELECT     SYS_CONNECT_BY_PATH (person_id, '/')     AS path
    FROM      applsys.fnd_user           u
    ,      hr.per_all_assignments_f      h
    WHERE      u.employee_id           = h.person_id
    AND     CONNECT_BY_ISCYCLE     = 1
    CONNECT BY NOCYCLE     PRIOR person_id = supervisor_id
         AND           SYSDATE      BETWEEN     effective_start_date
                             AND      effective_end_date
    ;
    

    If you would care to post CREATE TABLE and instructions INSERT for some samples, so I could test it.

    Note there is no START WITH clause.

    If, for example, Jones is the architect of Scott, Scott is the main contractor of Adams and Adams is the architect of Jones (much to other lines is not involved in a loop), then displays 3 rows of output, such as

    PATH
    ---------------------
    Jones/Scott/Adams
    Scott/Adams/Jones
    Adams/Jones/Scott
    

    Moreover, all the same CONNECT BY queries on these tables can be a lot faster if you've made the join and date filtering in a separate subquery first:

    WITH     combined_data     AS
    (
         SELECT     person_id, supervisor_id
         FROM      applsys.fnd_user           u
         ,      hr.per_all_assignments_f      h
         WHERE      u.employee_id      = h.person_id
         AND     SYSDATE      BETWEEN     effective_start_date
                        AND      effective_end_date
    )
    SELECT     SYS_CONNECT_BY_PATH (person_id, '/')     AS path
    FROM     combined_data
    WHERE     CONNECT_BY_ISCYCLE     = 1
    CONNECT BY NOCYCLE     PRIOR person_id = supervisor_id
    ;
    
  • Error in Trigger (PL/SQL: ORA-01744: INTO inappropriate)

    Hello
    I wrote the trigger in the following format... As the initial trigger is about 700 lines, as well, everything is written here... Please cooperate...
     CREATE OR REPLACE TRIGGER --
    AFTER UPDATE OF COL1
    ON TAB1
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    WHEN (NOT(OLD.COL1 IS NULL AND NEW.COL1=0))
    DECLARE
     --
     --
    rowToins PAK1.fdList;
    i number;
    BEGIN
     IF :NEW.COL2='V' THEN
     INSERT INTO DEST(
      ---
      ---
      D_AT)
     SELECT * FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB10.ID) AS D_AT
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    ELSEIF :NEW.COL2 ='H' THEN
     SELECT * FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB9.ID) AS D_AT
     BULK COLLECT INTO rowToins
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    
     i:=rowToins.FIRST;
     WHILE i IS NOT NULL LOOP
     --insert row 1
      PAK1.fun2(rowToins(i).<col>,
      ----
      );
     i:=rowToins.NEXT(i);
     END LOOP;
    END IF;
    END;
    /
    The above code gives the error...
    PL/SQL: ORA-01744: inappropriate INTO
    So, how can I fix the code...

    Thank you

    Sorry my mistake, it should be like this

     SELECT * BULK COLLECT INTO rowToins
     FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB9.ID) AS D_AT
    
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    
  • Error (74,34): PL/SQL: ORA-00928: falta the word clave SELECT

    INSERT SHOW ME BECAUSE AN ERROR ORA-00928: WHEN I AM IN COMPLIANCE WITH THE SINTASIX



    create or replace
    Procedure metodo_inventario (tipo_inventario varchar2)
    As
    number of;
    date of pl_fecha_factura;
    number of pl_numero_factura;
    pl_id_tp_movimiento nucreate or replace
    Procedure metodo_inventario (tipo_inventario varchar2)
    As
    number of;
    date of pl_fecha_factura;
    number of pl_numero_factura;
    number of pl_id_tp_movimiento;
    number of pl_id_producto;
    number of pl_cantidad;
    number of pl_vlr_unitario;
    number of pl_vlr_vairable;
    number of pl_vlr_peps;
    number of pl_vlr_upes;
    number of;
    number of;

    Begin
    pl_vlr_promedio: = 0;
    pl_vlr_peps: = 0;
    pl_vlr_upes: = 0;
    : = 0 ;
    : = 0 ;

    -> primero is crea una tabla auxiliar of facturas...
    / * Start
    create the table as
    Select *.
    of c_factura;

    ALTER TABLE
    ADD ("ESTADO" DEFAULT NUMBER 1 NOT NULL);
    end; * /
    If (tipo_inventario = '% PEP') then

    loop
    Selección - of the first factura...
    If (tipo_movimiento = 'COMPRA %') then

    Select min (FECHA_FACTURA)
    min (NUMERO_FACTURA)
    in pl_fecha_factura, pl_numero_factura
    of
    where State = 1;

    Select FECHA_FACTURA
    NUMERO_FACTURA
    ID_TP_MOVIMIENTO
    ID_PRODUCTO
    AMOUNT - amount
    VLR_UNITARIO - vlr law
    , (AMOUNT * VLR_UNITARIO)-total of vlr
    -, AMOUNT - total, und-> este to hace a select aside para sumar...
    -, (AMOUNT * VLR_UNITARIO)-total, vlr-> este to hace a select aside para sumar...
    IN pl_fecha_factura
    pl_numero_factura
    pl_id_tp_movimiento
    pl_id_producto
    pl_cantidad
    pl_vlr_unitario
    pl_vlr_variable
    of
    where NUMERO_FACTURA = pl_numero_factura
    and State = 1;

    Select the amount, vlr_unitario
    in pl_cantidad, pl_vlr_unitatrio
    of
    where State = 1
    and numero_factura = pl_numero_factura;

    estado set update = 0
    where numero_factura = pl_numero_factura;

    insert into c_inventario_final ('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
    VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO.
    S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura',
    pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad,
    pl_vlr_unitario, pl_vlr_variable, (pl_cantida +), (pl_vlr_peps + pl_vlr_variable);
    end if;
    end loop;

    exception
    while others then
    dbms_output.put_line (SQLERRM);
    -> PROCEDURE OF GENERACIÓN INVENTARIO MEOTDOS...
    end;
    House;
    number of pl_id_producto;
    number of pl_cantidad;
    number of pl_vlr_unitario;
    number of pl_vlr_vairable;
    number of pl_vlr_peps;
    number of pl_vlr_upes;
    number of;
    number of;

    Begin
    pl_vlr_promedio: = 0;
    pl_vlr_peps: = 0;
    pl_vlr_upes: = 0;
    : = 0 ;
    : = 0 ;

    -> primero is crea una tabla auxiliar of facturas...
    / * Start
    create the table as
    Select *.
    of c_factura;

    ALTER TABLE
    ADD ("ESTADO" DEFAULT NUMBER 1 NOT NULL);
    end; * /
    If (tipo_inventario = '% PEP') then

    loop
    Selección - of the first factura...
    If (tipo_movimiento = 'COMPRA %') then

    Select min (FECHA_FACTURA)
    min (NUMERO_FACTURA)
    in pl_fecha_factura, pl_numero_factura
    of
    where State = 1;

    Select FECHA_FACTURA
    NUMERO_FACTURA
    ID_TP_MOVIMIENTO
    ID_PRODUCTO
    AMOUNT - amount
    VLR_UNITARIO - vlr law
    , (AMOUNT * VLR_UNITARIO)-total of vlr
    -, AMOUNT - total, und-> este to hace a select aside para sumar...
    -, (AMOUNT * VLR_UNITARIO)-total, vlr-> este to hace a select aside para sumar...
    IN pl_fecha_factura
    pl_numero_factura
    pl_id_tp_movimiento
    pl_id_producto
    pl_cantidad
    pl_vlr_unitario
    pl_vlr_variable
    of
    where NUMERO_FACTURA = pl_numero_factura
    and State = 1;

    Select the amount, vlr_unitario
    in pl_cantidad, pl_vlr_unitatrio
    of
    where State = 1
    and numero_factura = pl_numero_factura;

    estado set update = 0
    where numero_factura = pl_numero_factura;

    insert into c_inventario_final ('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
    * VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO, *.
    * S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura', *)
    * pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad, *.
    * pl_vlr_unitario, pl_vlr_variable, (pl_cantida +), (pl_vlr_peps + pl_vlr_variable); *
    end if;

    end loop;

    exception
    while others then
    dbms_output.put_line (SQLERRM);
    -> PROCEDURE OF GENERACIÓN INVENTARIO MEOTDOS...
    end;

    THANK ME THAT COLLABORATE WITH THE CORRECTION OF THIS ERROR...

    THANK YOU, GOOD DAY...
    REYNEL MARTINEZ SALAZAR

    Hola Amigo,
    Como Estes?
    Buena Noche

    It's all the Spanish I know (almost) :)

    If you can translate your English error could be useful in the meantime let me brush up on my Spanish language ;)

    On the second opinion, your column name insert why there quotes around it?
    try to set it to

    insert into c_inventario_final(FECHA_FACTURA, ID_TIPO_MOVIMIENTO,   /* quotes removed*/
    VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO,
    S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura',
    pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad,
    pl_vlr_unitario, pl_vlr_variable, (pl_cantida+pl_cant_aux), (pl_vlr_peps+pl_vlr_variable)
    

    See you soon!
    Bobin

    Published by: Buga on November 15, 2009 18:31

  • ORA-01436: CONNECT loop in the user data, but CONNECT_BY_ISCYCLE is equal to ZERO all the

    Hello

    When I run query below, it always throws the below error:
    SELECT connect_by_root code AS code_root,
        CODE,
        CODE_DESC,
        UP_CODE 
      FROM DI_CODE_LEVEL
      WHERE TYPE_CODE='SP'
        CONNECT BY PRIOR CODE=UP_CODE;
    
    ORA-01436: CONNECT BY loop in user data
    01436. 00000 -  "CONNECT BY loop in user data"
    But when I use NOCLYCLE and CONNECT_BY_ISCYCLE to see which line is in question.
    It shows nothing, which means CONNECT_BY_ISCYCLE = ZERO for all rows.
    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
          WHERE TYPE_CODE='SP'
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
        ) 
    where ISCYCLE>0;
    Is there another reason that sql would lift ORA-01436?
    If there is a loop, then will the combination of NOCYCLE, CONNECT_BY_ISCYCLE will show?

    Thank you

    Hello

    Apparently, one or more of the "SP" lines are at the origin of the problem.
    The WHERE clause is applied after the CONNECT BY is finished, saying:

    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
          WHERE TYPE_CODE='SP'
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
        )
    where ISCYCLE>0;
    

    is equivalent to

    select * from (
        SELECT connect_by_root code AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE ,
            CONNECT_BY_ISCYCLE AS ISCYCLE
          FROM DI_CODE_LEVEL
            CONNECT BY NOCYCLE PRIOR CODE=UP_CODE
        )
    WHERE    TYPE_CODE = 'SP'
    AND     ISCYCLE   > 0;
    

    To see where the loop occurs, you must include the lines where type_code = "SP".

    When you debug "ORA-01436: CONNECT IN a loop in the user data ', view SYS_CONNECT_BY_PATH (uk,...), where the United Kingdom is a unique key. That will tell you much more than just the root information. You might want this:

    SELECT  connect_by_root code                AS code_root,
            CODE,
            CODE_DESC,
            UP_CODE
    ,     SYS_CONNECCT_BY_PATH (code, '/')     AS path          -- For debugging
    ,       CONNECT_BY_ISCYCLE                AS ISCYCLE     -- For debugging
    FROM      DI_CODE_LEVEL
    -- WHERE TYPE_CODE = 'SP'     -- Commented out for debugging
    where      ISCYCLE > 0          -- For debugging
    CONNECT BY NOCYCLE      PRIOR CODE = UP_CODE
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
    Explain how you get these results from these data.
    Always tell what version of Oracle you are using.

  • Error with the default data type

    Hello

    My source and target both oracle tables, but on the other physical schema. The target tables are created based on the source and therefore the accuracy are defined according to the source columns. The precision of the number type of is not defined in my source and when I turn the tide in ODI his supports length 22 of the default precision. So, I created my target precisely 22 and run my mapping. I use LKM SQL for Oracle, then IKM SQL control.

    The mapping will fail with the following error:

    1438: 22003: java.sql.BatchUpdateException: ORA-01438: value larger than the precision specified for the column
    1438: 22003: java.sql.SQLDataException: ORA-01438: value larger than the precision specified for the column

    java.sql.BatchUpdateException: ORA-01438: value larger than the precision specified for the column

    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
    at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
    at com.sunopsis.sql.SnpsQuery.executeBatch (SnpsQuery.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders (SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt (SnpSessTaskSqlC.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (SnpSessStep.java)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (SnpSession.java)
    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (DwgCommandSession.java)
    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (DwgCommandBase.java)
    at com.sunopsis.dwg.cmd.e.j (e.java)
    at com.sunopsis.dwg.cmd.g.z (g.java)
    at com.sunopsis.dwg.cmd.e.run (e.java)
    at java.lang.Thread.run(Thread.java:619)

    I have 2 questions about it:
    (1) how do I know which column data greater than the specified precision available? (I tried to get the column name in the table SNP_SESS_TXT_LOG in the repository of work but don't know if it contains the information I was looking for)
    (2) how can I change the default precision for the type of data number from 22 to 38 (max value)?

    Receive your answer.

    Thank you!

    According to the 423858.1, it of the problem with the JDBC driver that reverse engineers and takes the default as 22. To work around the problem, you will need to use Oracle RKM to customize boning them

Maybe you are looking for

  • How to extend the life of my MacPro 2006 1.1?

    I'm hoping to extend the life of my 2006 MacPro1.1, whose startup disk has developed a Squeak. I have received conflicting advice from vendors on a possible solution and would like knowledgeable opinions. Here is a partial configuration: A Macintosh

  • Add-on developer corner. Problem to add a screenshot to my module?

    At the corner of the developer for my module there is a problem adding a screenshot? I choose the topic of listentry change, add the png screenshot (it appears). Now when I click on save button changes there is no response, the server attempts toto a

  • Problem with the table editor

    Hi again, in the user interface editor, I set up a table with 7 columns, including a tag line. Now I have 3 column is the column on the right. as a result, I chose 3 column, pressed '' Cut column '', and indeed, the column is part. However, I can't d

  • Windows Update crashes computer

    Update Windows automatically updated and then restarted my computer yesterday.  The computer does not restart.  I tried F8 to restart last good configuration, but it will not - restart it crosses all the drivers and then freezes.  If I click on "Star

  • EOS 70 d SD error map

    Hello! I have a problem with the camera that map shows the error on the LCD. I tried with different SD but the camero shows the same error message: no memory access insert, modify the cerad, or format it with the camera. When I try to format the SD c