Home » SQL & PL/SQL » SQL & PL/SQL » How to call a function? (merged)
How to call a function? (merged) [message #240069] Thu, 24 May 2007 01:24 Go to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

Dear Experts, please let me know, how to call a procedure in oracle
Re: how to call a function [message #240071 is a reply to message #240069] Thu, 24 May 2007 01:29 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi,

just read the oracle documentation

regards
shanth
Re: how to call a function [message #240073 is a reply to message #240069] Thu, 24 May 2007 01:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Call from what?

Regards
Michel
Re: how to call a function [message #240074 is a reply to message #240069] Thu, 24 May 2007 01:31 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Ok, here goes:
Begin
  -- a function call in PL/SQL
  a_variable := yourfunction(yourparameters);

  -- a procedure call in PL/SQL
  yourprocedure(yourparameters);
End;


Suggested further reading: PL/SQL User Guide and Reference, SQL User Guide and Reference.

MHE
Re: how to call a function [message #240076 is a reply to message #240074] Thu, 24 May 2007 01:34 Go to previous messageGo to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

thank you maaher
Re: how to call a function [message #240077 is a reply to message #240074] Thu, 24 May 2007 01:37 Go to previous messageGo to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

dear maaher,
i've called like this........

a_variable :=emp_id(20)
emp_id is my function name....................
20 is the parameter

but i'm getting an error
Re: how to call a function [message #240078 is a reply to message #240069] Thu, 24 May 2007 01:38 Go to previous messageGo to next message
breddypatil
Messages: 4
Registered: May 2007
Location: Bangalore
Junior Member
hi,

where exactly you want to call a procedure?

Assuming if you are calling from some other function or procedure

begin
---
PROC_NAME(--,--) -- Procedure is called here.
---
END;

or if it is a stored procedure. you can directly execute in SQL* plus

>EXECUTE PROC_NAME

need a function [message #240079 is a reply to message #240069] Thu, 24 May 2007 01:39 Go to previous messageGo to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

Dear Experts,
I need a function for emp table,
i need the result like by providing the deptno, i've to get the records related to that deptno....

please give me the function

thank you very much
Re: how to call a function [message #240081 is a reply to message #240078] Thu, 24 May 2007 01:42 Go to previous messageGo to next message
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

i'm calling that function directly from sql prompt(sqlplusw)
Re: how to call a function [message #240083 is a reply to message #240077] Thu, 24 May 2007 01:45 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
sunsanvin wrote on Thu, 24 May 2007 08:37
but i'm getting an error


00000, 00000, "an error"
// *Cause: unspecified user or Oracle error
// *Action: 
// ** User error:   replace user or correct code
// ** Oracle error: a solution, depending on the error code.


Just kidding, I'd like to see a little bit more information:
1. Did the function compile without errors?
2. What's the error message you got?
3. What does the function do?

MHE
Re: need a function [message #240084 is a reply to message #240079] Thu, 24 May 2007 01:45 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please post your Oracle version and what you already tried.
I don't think we are here to make your homework.

Moreover the specification is not complete.
Do you want a cursor on emp table?
Do you want a string containing a list of ename?
Do you want a string containing an array of empno?
Do you want the function displays the records?
...

I forgot to mention 2 important links:
Application Developer's Guide - Fundamentals
PL/SQL User's Guide and Reference

Regards
Michel

[Updated on: Thu, 24 May 2007 01:47]

Report message to a moderator

Re: need a function [message #240085 is a reply to message #240079] Thu, 24 May 2007 01:47 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
sunsanvin wrote on Thu, 24 May 2007 08:39
Dear Experts,
I need a function for emp table,
i need the result like by providing the deptno, i've to get the records related to that deptno....

please give me the function

thank you very much


that's called "a WHERE clause" ;):
SQL> SELECT empno
  2  FROM   emp
  3  WHERE  deptno = &whatever_deptno_you_want;
Enter value for whatever_deptno_you_want: 10
old   3: WHERE  deptno = &whatever_deptno_you_want
new   3: WHERE  deptno = 10

     EMPNO
----------
      7839
      7782
      7934

SQL> SELECT empno
  2  FROM   emp
  3  WHERE  deptno = &whatever_deptno_you_want;
Enter value for whatever_deptno_you_want: 30
old   3: WHERE  deptno = &whatever_deptno_you_want
new   3: WHERE  deptno = 30

     EMPNO
----------
      7698
      7654
      7499
      7844
      7900
      7521

6 rows selected.


MHE
Re: how to call a function [message #240116 is a reply to message #240083] Thu, 24 May 2007 03:03 Go to previous messageGo to next message
whoru
Messages: 5
Registered: May 2007
Location: Pune
Junior Member

How to call it from forms 6????
I mean a database Procedure ...
Re: how to call a function [message #240130 is a reply to message #240116] Thu, 24 May 2007 03:49 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
whoru wrote on Thu, 24 May 2007 10:03

How to call it from forms 6????
I mean a database Procedure ...


Is this related to the original question or are you hijacking a thread?

MHE
Re: how to call a function [message #240131 is a reply to message #240116] Thu, 24 May 2007 03:51 Go to previous messageGo to next message
shanthkumaar
Messages: 156
Registered: February 2007
Location: india,chennai
Senior Member

hi

@whoru>> check this one

NOTE:you should have asked this question in form's forum.

@sunsanvin>> please post the error message as Maaher have asked.

[edit>>>a bit slow Embarassed ]


regards
shanth

[Updated on: Thu, 24 May 2007 03:53]

Report message to a moderator

Re: How to call a function? (merged) [message #240149 is a reply to message #240069] Thu, 24 May 2007 04:34 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
@sunsanvin, you are on the OraFAQ Forum long enough to know that you shouldn't open a new topic for the same problem. Those two have been merged; next time, please, continue discussion in existing topic.
Previous Topic: How to pass hashmap as arguments to stored procedure
Next Topic: Indexing
Goto Forum:
  


Current Time: Fri Dec 09 00:04:28 CST 2016

Total time taken to generate the page: 0.08329 seconds