Home » SQL & PL/SQL » SQL & PL/SQL » function call another function?
icon14.gif   function call another function? [message #233010] Tue, 24 April 2007 06:58 Go to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Dear friends,

I want a Pl/sql program.I have an doubt function call
another function? is ok means i want a plsql code.is possible trigger call to function?

PLease Try ..i need code.

Arun

[Updated on: Tue, 24 April 2007 07:04]

Report message to a moderator

Re: function call another function? [message #233015 is a reply to message #233010] Tue, 24 April 2007 07:03 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you encounter a problem doing so? Could you post the code you used and actual error message? Or, even better, copy and paste SQL*Plus session.
Re: function call another function? [message #233016 is a reply to message #233010] Tue, 24 April 2007 07:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, it can, just gives the name of the function you want to call.

Regards
Michel
Re: function call another function? [message #233018 is a reply to message #233016] Tue, 24 April 2007 07:05 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member

Laughing

is possible trigger call to function? Razz
Re: function call another function? [message #233020 is a reply to message #233018] Tue, 24 April 2007 07:08 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes it is. Just name it.

Regards
Michel
Re: function call another function? [message #233025 is a reply to message #233020] Tue, 24 April 2007 07:15 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member



michael i want program ..pls
Re: function call another function? [message #233027 is a reply to message #233025] Tue, 24 April 2007 07:19 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Which program?
There are many exemples in PL/SQL User's Guide and Reference.
Please read it.

Regards
Michel

Re: function call another function? [message #233030 is a reply to message #233027] Tue, 24 April 2007 07:29 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member



thanks Micheal
Re: function call another function? [message #233034 is a reply to message #233030] Tue, 24 April 2007 07:41 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member



Micheal,

I want a sample pl/sql in following :

1) how can i call from trigger to functions?

2)how can i call from trigger to trigger(possible)?

3) how can i call from function to function?

4) how can i call procedure to trigger?
Re: function call another function? [message #233036 is a reply to message #233034] Tue, 24 April 2007 07:47 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
2) is not possible

For the rest, please first have a look at the documentation and then come back if you don't understand something.

Regards
Michel
Re: function call another function? [message #233040 is a reply to message #233036] Tue, 24 April 2007 07:51 Go to previous messageGo to next message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member



ok ok .thanks
Re: function call another function? [message #233045 is a reply to message #233034] Tue, 24 April 2007 07:57 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
akkumar81 wrote on Tue, 24 April 2007 14:41
Micheal,

I want a sample pl/sql in following :

1) how can i call from trigger to functions?


Here's a test script:
CREATE TABLE yourtable(thetext VARCHAR2(20))
/

CREATE FUNCTION yourfunction (p_thetext IN VARCHAR2)
   RETURN VARCHAR2
IS
BEGIN
   
   RETURN INITCAP(p_thetext);
END yourfunction;
/
sho err

CREATE TRIGGER yourtrigger
   BEFORE INSERT OR UPDATE
   ON yourtable
   FOR EACH ROW
BEGIN
   -- the function call:
   :NEW.thetext    := yourfunction (:NEW.thetext);
END;
/
sho err

INSERT INTO yourtable VALUES('ABCDE')
/
SELECT *
FROM   yourtable
/

DROP TABLE yourtable
/

DROP FUNCTION yourfunction
/


The trigger calls a function as you can see. There's nothing more to it.

akkumar81 wrote on Tue, 24 April 2007 14:41
2)how can i call from trigger to trigger(possible)?

Triggers are...well...triggered, not invoked by users but by events. In the case of the code above, the trigger is invoked by my insert. It fires right before the actual insert takes place.

akkumar81 wrote on Tue, 24 April 2007 14:41
3) how can i call from function to function?

The same as you call the function in the trigger.

akkumar81 wrote on Tue, 24 April 2007 14:41
4) how can i call procedure to trigger?
Guess for yourself: triggers are invoked by events. Procedures can be called.

Don't you think it's time you start reading the documentation? And why don't you start at the FAQ pages at OraFAQ. OraFAQ is more than the forum Wink.

MHE
Re: function call another function? [message #233049 is a reply to message #233045] Tue, 24 April 2007 08:12 Go to previous message
akkumar81
Messages: 144
Registered: February 2007
Location: india
Senior Member



Maaher,

Thanku very much .I got idea.

Arun..
Previous Topic: Getting Column Names Updated When An Update Statement Fires
Next Topic: How to get Oracle sid?
Goto Forum:
  


Current Time: Sun Dec 04 12:47:41 CST 2016

Total time taken to generate the page: 0.07470 seconds