Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using function in SQL Query

Status
Not open for further replies.

Jilly777

Programmer
Aug 9, 2010
1
US
I know nothing. I am trying to change an existing report. The earlier version used a function in a package in an SQL Query. For example:

SELECT A.FOO, DB.PKG.TO_STR(A.ID) AS NUM
FROM DB.TBL A
WHERE FOO >= :p_start
AND FOO <= :p_end
ORDER BY FOO

Now, I want to replace the function in the package. I thought I could just put the function in the Program Units (let's say it is MY_FUNC) and call it like:

SELECT A.FOO, MY_FUNC(A.ID) AS NUM
FROM DB.TBL A
WHERE FOO >= :p_start
AND FOO <= :p_end
ORDER BY FOO

But, it says MY_FUNC is an invalid identifier. How can I use a function inside the report in the Queries section?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top