-
how to exec function
How to exec function...?.
I donot want to call them thru procedures...then How to exec them? ..which are already available in database.
I appriciate your help..
This is for PORTAL....it has 1000s os functions built in.To query any thing we have to do thru functions..so I need some help..I do not know how to do?.
Platform sunSolaris 5.8. database 9.0.1.
portal version9.0.2.
Thanks.
Thanigaivasan.
-
I'm not sure what you are looking for but here is an example.
SELECT returnsomeinfor('1', '2') FROM dual;
Functions are different from procedure because when they execute they need to return one value to something. In this case it returns a value to a select statement. You can also do:
DBMS_OUTPUT.PUT_LINE(returnsomeinfor('1', '2'));
So how you execute the functions really depends on what functions you are running, the input that they need and the type of information that they return. Do they return strings, number etc.
-
Thanks for the speedy reply..
In Portal all are built in thru functions...no much tables contains informations..For ex. to know the version..I have to exec some function to get it..
unlike in database we do select * from v$database...to get informations about database..
that makes crazy..I am not so good at pl/sql..
yes it returns numbers and strings...depends on the query.How to query I need help.
Thanks.
Thanigaivasan.
-
You can do a desc on a function. It will tell you what the arguments are. i.e.
SQL> desc IS_ALTER_COLUMN
FUNCTION IS_ALTER_COLUMN RETURNS BOOLEAN
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ ------
COLUMN_NAME VARCHAR2 IN
You should be pestering the vendor to tell you how the database works.
-
Function can not be executed. Example:
SQL> CREATE OR REPLACE FUNCTION CAL(A IN NUMBER,
B IN NUMBER,
OPERATOR IN VARCHAR2)
RETURN NUMBER
IS
BEGIN
IF OPERATOR='*' THEN
RETURN(A*B);
ELSIF OPERATOR='+' THEN
RETURN(A+B);
ELSIF OPERATOR='-' THEN
RETURN(A-B);
ELSIF OPERATOR='/' THEN
RETURN(A/B);
ELSE NULL;
END IF;
EXCEPTION
WHEN ZERO_DIVIDE THEN
RETURN(NULL);
END;
/
Function created.
SQL> select cal(3, 8, '*') from dual;
CAL(3,8,'*')
------------
24
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|