using dbms_output.put_line in SQL Developer

143 views
Skip to first unread message

PAscal L

unread,
Oct 6, 2017, 6:16:20 PM10/6/17
to Better Oracle functions support
Hi,
I just made a test using PostgreSQL (orafce 3.3, pg 9.5.1) with SQL developer (4.2), to see if dbms_output was working.

I seems that with SQL developer only one line is retrieved !?

My test case:

CREATE or replace FUNCTION exemple(integer,integer) RETURNS void AS '
begin
for c in $1..$2
loop
  perform dbms_output.put_line(to_char(c));
end loop;
end' LANGUAGE 'plpgsql';
/

select dbms_output.serveroutput(true) from dual;

select dbms_output.enable(1000) from dual;

do ' begin perform exemple(2,7);end; ';
/

output is:
2

Pavel Stehule

unread,
Oct 7, 2017, 3:20:31 PM10/7/17
to orafce-...@googlegroups.com
It doesn't looks like Orafce issue

When I run your example from psql, I get

postgres=# do ' begin perform exemple(2,7);end; ';
2
3
4
5
6
7
DO

Orafce uses following code for sending a message:

        pq_beginmessage(&msgbuf, 'N');

        /*
         * FrontendProtocol is not avalilable in MSVC because it is not
         * PGDLLEXPORT'ed. So, we assume always the protocol >= 3.
         */

#ifndef _MSC_VER

        if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
        {

#endif

            pq_sendbyte(&msgbuf, PG_DIAG_MESSAGE_PRIMARY);
            pq_sendstring(&msgbuf, buffer);
            pq_sendbyte(&msgbuf, '\0');
   
#ifndef _MSC_VER

        }
        else
        {
            *cursor++ = '\n';
            *cursor = '\0';
            pq_sendstring(&msgbuf, buffer);
        }
       
#endif 

        pq_endmessage(&msgbuf);
        pq_flush();

Maybe SQL developer expecting some different protocol, maybe there is some bug in SQL developer.

What you see if you run:

do $$ begin for i in 1..10 loop raise notice '%', i; end loop; end $$;

?

--
You received this message because you are subscribed to the Google Groups "Better Oracle functions support" group.
To post to this group, send email to orafce-general@googlegroups.com.
Visit this group at https://groups.google.com/group/orafce-general.

PAscal L

unread,
Oct 7, 2017, 5:56:05 PM10/7/17
to Better Oracle functions support
do $$ begin for i in 1..10 loop raise notice '%', i; end loop; end $$;

returns
1


Pavel Stehule

unread,
Oct 7, 2017, 11:06:15 PM10/7/17
to orafce-...@googlegroups.com
so it looks like SQL developer issue

Regards

Pavel

PAscal L

unread,
Oct 8, 2017, 2:30:45 PM10/8/17
to Better Oracle functions support
OK,
this comes from Oracle SQL developer ;o(
Reply all
Reply to author
Forward
0 new messages