PL/SQL: ORA-00904: "ArticleWarehouseCode": Invalid Identifier

40 Views Asked by At

I'm trying to insert data from DB Oracle (Sql Developer) to SQL Server through dblink oracle, but when I run the code, I get this error message:

Report error -
ORA-06550: riga 16, colonna 64:
PL/SQL: ORA-00904: "ArticleWarehouseCode": Invalid identifier
ORA-06550: riga 16, colonna 9:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

Code

declare 
    cod_magaz varchar2(255) := 'ABC123';
    des_parte varchar2(255) := 'Tubo di ferro';
    
    res_query     number;
    ora_rc        number;
    ora_msg       varchar2(4000);
    
begin
    dbms_output.put_line('Magazzino da scrivere -> ' || cod_magaz);
    dbms_output.put_line('Descrizione da scrivere -> ' || des_parte || chr(13) || chr(10));
    
    res_query := 0;
    
    begin 
        insert into OLD_XIT_MSSQL_ANAG("ArticleDescription", "ArticleWarehouseCode", "ArticleManage")
        values(des_parte, cod_magaz, 1);
        
    exception
        when others then
            rollback;
            res_query := 1;
            ora_rc := sqlcode;
            ora_msg := sqlerrm;
    end;
    
    if res_query = 0 then
        dbms_output.put_line('Inserimento avvenuto con successo!');
        commit;
    else
        dbms_output.put_line('Inserimento fallito! ORA ' || ora_rc || ' (' || ora_msg || ')');
    end if;
end;

Type definition in SQL Server:

[ArticleWarehouseCode] [nvarchar](max) NULL,
[ArticleDescription] [nvarchar](max) NULL,
[ArticleManage] [int] NOT NULL,

I can't change the max value of ArticleWarehouseCode and ArticleDescription.

I checked more time the right variables name. Can anyone tell an ideo to solve this error?

0

There are 0 best solutions below