Le prime e le seconde istruzioni "put_line" nel blocco PL/SQL sottostante avranno esito positivo, ma l'ultimo fallisce. Perché? Potrebbe essere un bug?Perché l'ultima istruzione PL/SQL non funziona utilizzando dbms_assert.enquote_literal?
declare
x varchar2(100);
begin
x := 'Test''';
dbms_output.put_line('x is: ' || x || ', enquoted x is: ' || dbms_assert.enquote_literal(replace(x, '''', '''''')));
x := 'Te''st';
dbms_output.put_line('x is: ' || x || ', enquoted x is: ' || dbms_assert.enquote_literal(replace(x, '''', '''''')));
x := '''Test';
dbms_output.put_line('x is: ' || x || ', enquoted x is: ' || dbms_assert.enquote_literal(replace(x, '''', '''''')));
end;
/
L'errore è:
Error report:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.DBMS_ASSERT", line 317
ORA-06512: at "SYS.DBMS_ASSERT", line 381
ORA-06512: at line 11
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause:
*Action:
Qualche idea?
Come sembra che abbia qualcosa a che fare con il primo carattere nella variabile. Getta se il primo carattere è un "" – SomeJavaGuy
Dai un'occhiata alla fonte di dbms_assert. –
Si sente come un comportamento bacato. – sstan