Skip to Main Content
  • Questions
  • How to run functions wich execute DML commands ?

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Jayme.

Asked: May 19, 2008 - 6:23 pm UTC

Last updated: May 20, 2008 - 4:07 pm UTC

Version: 9.2.0

Viewed 1000+ times

You Asked

I am using LUA to write an application that should run some Oracle functions that need parameters, and also execute inserts or update DML commands. Is there any way of running these functions without using a select (function) command ?
I was thinking of using an anonymous procedure. I didn't find any way of declaring its parameters though.

Thank you in advance.

Jayme

and Tom said...

Well, I've never programmed in "LUA" (actually, this is the first I've ever heard of it...)

But, typically, one invokes a stored procedure or function by:

begin
procedure_name( :x, :y, :z );
end;


NOT by calling a function from sql (that would be the exceptional way to invoke code - it would be more normal to use begin / end)


Not knowing anything about LUA or how it 'binds to oracle', I cannot tell you how to bind to a procedure, but it should not be any different than binding to an update statement...

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

I must use function calls

Jayme Jeffman, May 20, 2008 - 2:53 pm UTC

Dear Sir,

I must use function calls, so I was trying to do something like :
<code>
 declare x number :=0;
 begin
   x:= function_name(p1,p2,p3);
 end;
/


How can I pass parameters to the begin/end block without creating a named procedure ?</code>
Tom Kyte
May 20, 2008 - 4:07 pm UTC

I answered that

just bind

as I demonstrated above.


answer me this, what would the code look like for:

update t set x = p1, y = p2, z = p3;


you will bind p1, p2, p3 in the same way.



Thank you very much.

Jayme Jeffman, May 20, 2008 - 5:25 pm UTC

Dear Tom,

Thank you very much for answering my question.
You are very kind.

Regards.

So how was it done??

Karthick, May 21, 2008 - 1:31 am UTC

Jayme when i googled this thread came at the top...

http://www.google.co.in/search?hl=en&q=How+to+call+oracle+function+in+LUA&meta=

so if you can post your solution in this thread it will be more useful.

Regards,

Karthick.
http://www.karthickarp.blogspot.com/

LUA. Can't argue against "Tables [being] the most important data structure" :)

Duke Ganote, May 21, 2008 - 11:11 am UTC

http://en.wikipedia.org/wiki/Lua_%28programming_language%29

"Tables are for Lua what lists are for Lisp: powerful data-structuring mechanisms"
http://pages.citebite.com/r5m1k5a7mcub

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library