When a query returns an empty result set ...
... In Oracle PL/SQL, an error 1403 is raised: SQL> -- SQL> drop table t; Table dropped. SQL> create table t(dummy int); Table created. SQL> declare 2 x varchar2(1); 3 -- l text; 4 l varchar2(40); 5 status integer; 6 high integer := 10; 7 begin 8 dbms_output.enable(); 9 for i in 1..high loop 10 select dummy into x from t; 11 dbms_output.put_line(to_char(i)); 12 end loop; 13 for i in 1..high loop 14 dbms_output.get_line(l, status); 15 -- raise notice 'i=% l=%', i, l; 16 end loop; 17 end; 18 / declare * ERROR at line 1: ORA-01403: no data found ORA-06512: at line 10 Help: https://docs.oracle.com/error-help/db/ora-01403/ ... In IvorySQL PL/ISQL, no error has raised and the target output variable is NULL (like in PL/PGSQL): $ cat t1.sql drop table t; create table t(dummy int); -- PLI/PGSQL declare x varchar2(1); l text; status integer; high integer := 10; begin dbms_output.enable(); for i in 1..high loop select dummy into x from t; dbms_output.put_line(to_char(i)); end loop; for i in 1..high loop dbms_output.get_line(l, status); raise notice 'i=% l=%', i, l; end loop; end; / $ psql -p 1521 -f t1.sql DROP TABLE CREATE TABLE psql:t1.sql:22: NOTICE: i=1 l=1 psql:t1.sql:22: NOTICE: i=2 l=2 psql:t1.sql:22: NOTICE: i=3 l=3 psql:t1.sql:22: NOTICE: i=4 l=4 psql:t1.sql:22: NOTICE: i=5 l=5 psql:t1.sql:22: NOTICE: i=6 l=6 psql:t1.sql:22: NOTICE: i=7 l=7 psql:t1.sql:22: NOTICE: i=8 l=8 psql:t1.sql:22: NOTICE: i=9 l=9 psql:t1.sql:22: NOTICE: i=10 l=10 DO $ I would like to know if this is intended behavior ? Thanks.
Hi Pierre,
I would like to know if this is intended behavior ?
We have successfully reproduced the issue and can confirm the behavioral difference you've observed. Yes, that is the expected behavior. Root Cause Analysis: This difference occurs because IvorySQL's PL/iSQL currently follows PostgreSQL's PL/pgSQL semantics rather than Oracle's. ---- Thanks, Oreo
participants (2)
-
Oreo Yang -
Pierre Forstmann