Home » Developer & Programmer » Reports & Discoverer » use of procedures (Oracle 10.2.0.1.0,,Report Builder 10.1.2.0.2)
use of procedures [message #584116] Wed, 08 May 2013 14:56 Go to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi,
i just want to know how can i create a procedure in the program unit and assign the output to a field
in the report. thanks in advance.

Regards,
Jay.
Re: use of procedures [message #584118 is a reply to message #584116] Wed, 08 May 2013 15:13 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That would rather be a function, I presume.

You create it in Object Navigator, by pushing the green + button. Specify its name, write code you find appropriate, compile. Once it is OK, create a formula column which would RETURN value returned by a function you've just created. That's all.
Re: use of procedures [message #584119 is a reply to message #584118] Wed, 08 May 2013 15:18 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,
I would be great help to me if illustrate with an example. Thanks in advance.

Regards
Jay
Re: use of procedures [message #584120 is a reply to message #584119] Wed, 08 May 2013 15:25 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Reports here so ...

Though, what example do you expect? Do you know how to click a green + button? Create a function code? Call it from another PL/SQL code?
Re: use of procedures [message #584121 is a reply to message #584120] Wed, 08 May 2013 15:31 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,
What i meant was is enough to use return statement like return (funtion /procedure/package name); in the formula column or should i copy the code. Thanks in advance.

Regards
Jay
Re: use of procedures [message #584122 is a reply to message #584121] Wed, 08 May 2013 15:35 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
RETURN is enough; you don't need to use the same code in a formula column again. Why would you?

Of course, that's a perfectly valid option - put the whole code into the formula column. But, in that case, you don't need that function at all.

However, if you want to call a function with different parameters from different formula column (for some reason), then a function is a better choice because every formula would just RETURN function's value. If anything changes in code, you maintain it only for the function - its calls from formula columns remain intact.

[Updated on: Wed, 08 May 2013 15:35]

Report message to a moderator

Re: use of procedures [message #584125 is a reply to message #584122] Wed, 08 May 2013 17:08 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,
with your help i could use functions in programming unit but what about procedures and packages?

Regards,
Jay.
Re: use of procedures [message #584131 is a reply to message #584125] Thu, 09 May 2013 00:12 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Certainly, you can use these as well, no problem.

For example: create a procedure which initializes some tables which are then used in report's query. You'd call that procedure from the After Parameter Form trigger.

Or, you want to log who and when executed that report - create a procedure which does that job and call it from the After Report trigger.

Packages are an "extension" to standalone functions/procedures (as they are packed into a package), so ... no problem in using them as well.
Previous Topic: about program units
Next Topic: AWR Report on SQL Developer
Goto Forum:
  


Current Time: Thu Mar 28 07:37:54 CDT 2024