plsql - Oracle Bind Variables, Procedures and a headache -


i wondering if can point me in right direction. have spent last little while trying work out how use bind variables in block code declares. issues every time try run code block in sql developer, returning error "bind variable "disp" not declared.

in non-block piece of code can results expecting. following know works , results for:

var disp varchar2(200); begin     test_procedure('test', 100, :disp); end; / print :disp 

the above code returns me value, test100.

however, if try move block of code, use single line in external application (java or php) start running trouble. have far is:

declare     disp varchar2(200); begin     test_procedure('test', 100, :disp); end; / print :disp 

when run above getting:

bind variable "disp" not declared

i have tried few different approaches using var inside declare box trying reference procedures variable definitions, none working me

you don't prefix local variable name colon.

declare     disp varchar2(200); begin     test_procedure('test', 100, disp); end; 

is valid pl/sql block. print sql*plus command, however, works sql*plus variables, not variables defined in pl/sql blocks. if have enabled it, use dbms_output print value in pl/sql

declare     disp varchar2(200); begin     test_procedure('test', 100, disp);     dbms_output.put_line( disp ); end; 

in sql developer, you'd need enable output first (view | dbms output bring window in newer versions of sql developer).

dbms_output not appropriate way return data client application (or you're depending on human see output in order something). it's useful package doing simple debugging or quick proof of concept. shouldn't assume caller of code has allocated buffer dbms_output write or has ability read you've written dbms_output.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -