DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: how to exec function

  1. #1
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    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.

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    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.

  3. #3
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    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.

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    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.

  5. #5
    Join Date
    Dec 2002
    Location
    USA
    Posts
    53
    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
  •  


Click Here to Expand Forum to Full Width