Toad World® Forums

pl/sql recursive function in the with clause


#1

Defining a function in the with clause works fine. Both with F5 and F9

with function f (n number) return number as begin return n; end f;
select f(6) from dual
/

But if the function is recursive, nothing happends, neither with F5 nor with F9

with function f (n number) return number as begin return case n when 2 then 2 else n*f(n-1) end; end f;
select f(6) from dual
/

Execute SQL via SQL-PLUS works.
Execute SQL via TSR generates Access Violation at Address 22B5DF4B in module QP5.dll Read of address 20.
Version: 12.7.0.55


#2

Your example works for me using every execution method. Does the access violation you get generate an error log? Look at the message and see if there’s a “Click here…” label. If so, generate the log and send the call stack.

On 03/23/2015 08:49 AM, laurentc.schneider_609 wrote:

pl/sql recursive function in the with clause

Thread created by laurentc.schneider_609
Defining a function in the with clause works fine. Both with F5 and F9 with function f (n number) return number as begin return n; end f; select f(6) from dual / But if the function is recursive, nothing happends, neither with F5 nor with F9 with function
f (n number) return number as begin return case n when 2 then 2 else n*f(n-1) end; end f; select f(6) from dual / Execute SQL via SQL-PLUS works. Execute SQL via TSR generates Access Violation at Address 22B5DF4B in module QP5.dll Read of address 20.

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.


#3

No, if I run in Toad in has no effect at all. Only in Toad Script Runner I got the Access Violation, and no LOG is written

There is no “Click here” button


#4

if I run in Toad in has no effect at all

No effect as in no error or as in no error and no results? I get 720 using F5, F9, and TSR in Toad 12.6. What version of Toad are you on?

Michael

On 03/23/2015 10:12 AM, laurentc.schneider_609 wrote:

RE: pl/sql recursive function in the with clause

Reply by laurentc.schneider_609
No, if I run in Toad in has no effect at all. Only in Toad Script Runner I got the Access Violation, and no LOG is written

There is no “Click here” button

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.


#5

I can reproduce now. I misidentified your example.

On 03/23/2015 10:12 AM, laurentc.schneider_609 wrote:

RE: pl/sql recursive function in the with clause

Reply by laurentc.schneider_609
No, if I run in Toad in has no effect at all. Only in Toad Script Runner I got the Access Violation, and no LOG is written

There is no “Click here” button

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.


#6

sorry, as I wrote above, 12.7.0.55, but I intended to post in the beta. It reproduces in 12.6.0.53.

The query works in 12.1.0.22 and 11.6.0.43