Home » SQL & PL/SQL » SQL & PL/SQL » DML stmt inside Functions
DML stmt inside Functions [message #238459] Fri, 18 May 2007 03:09 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Dear Michel,

Is this possible function inside contain DML statements?

same as function inside execute immediate?


Expecting Your replies .
Fine and thnx

Arun..
Re: DML stmt inside Functions [message #238463 is a reply to message #238459] Fri, 18 May 2007 03:27 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select sysdate from dual;
SYSDATE
-------------------
18/05/2007 10:20:21

1 row selected.

SQL> declare dt date;
  2  begin
  3    execute immediate 'begin :dt := sysdate; end;' using out dt;
  4    dbms_output.put_line (dt);
  5  end;
  6  /
18/05/2007 10:23:06

PL/SQL procedure successfully completed.

Seems OK.

Btw, this is not "AskMichel" so don't ask to me ask every one.
Moreover, you know the link for SQL Reference and PL/SQL User's Guide and Reference.

Regards
Michel
Re: DML stmt inside Functions [message #238467 is a reply to message #238463] Fri, 18 May 2007 03:34 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Dear micheal,

I have an some doubts in function vs procedures.In function and procedures both are doing same work.Any restrictions are procedures compare to function (or) Any restrictions are function compare to procedures.
please reply.

Which time choose procedures and which time choose functions?

Expecting replies..

Arun..
Re: DML stmt inside Functions [message #238468 is a reply to message #238467] Fri, 18 May 2007 03:37 Go to previous messageGo to next message
caliguardo
Messages: 107
Registered: February 2007
Location: Chennai
Senior Member

I guesss you need to google it or better search in this forum.
Re: DML stmt inside Functions [message #238473 is a reply to message #238459] Fri, 18 May 2007 04:02 Go to previous message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
Are you really unable or lazy to follow the link Michel provided you?

PL/SQL User's Guide and Reference
Chapter 8 Using PL/SQL Subprograms
- Understanding PL/SQL Procedures
- Understanding PL/SQL Functions
- ...
Previous Topic: Calculate second highest salary
Next Topic: Utl_File to export blob problem
Goto Forum:
  


Current Time: Tue Dec 06 00:02:31 CST 2016

Total time taken to generate the page: 0.12889 seconds