Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Function

RE: Function

From: Hamid Alavi <hamid.alavi_at_quovadx.com>
Date: Mon, 04 Feb 2002 10:11:39 -0800
Message-ID: <F001.004051ED.20020204100736@fatcity.com>

OK, here it is:
I want to send the name of table and first column name and the valu of this column to the function and return the description for that value like this:

table1                              Values
col1 number(3)                          1
col2 varchar2(30)                               abc


f_get_desc('table1','col1',1) must return abc. THX -----Original Message-----
Sent: Monday, February 04, 2002 9:41 AM
To: Multiple recipients of list ORACLE-L

Hamid,

Could you explain, what are the parameters of your function, specifically: 'code_column_name' (is it column name?) and 'code_id'.

Igor Neyman, OCP DBA
ineyman_at_perceptron.com

> Hi list,
>
> I have this function it's compile ok but doesn't return any value:
>
> CREATE OR REPLACE function f_get_desc2
> (table_name in varchar2,
> code_column_name in varchar2,
> code_id in varchar2)
> return varchar2
> is
> return_desc varchar2 (100) ;
> DESC_VAL VARCHAR2(100);
>
> begin
> SELECT COLUMN_NAME INTO DESC_VAL FROM USER_TAB_COLUMNS ?????
> WHERE TABLE_NAME =':table_name' AND COLUMN_ID = 2 ; ????
> -- here I want to get the description column name from
> user)tab_columns.....then get the value based on the ID
> execute immediate 'select ' || DESC_VAL ||
> ' from ' || table_name || ' where ' || code_column_name ||
> ' = :id' into return_desc using code_id ;
> return return_desc ;
> end ;
> /
>
> I pass column_name ,code & value of the code to function then get the name
> of description Column from table_name and finally get the description
based
> on table_name,descripton column & value, BUT doesn't return any value
> I am not sure but the ?mark lines doesn't return any value.
>
> Thanks for your help.
>
> Hamid Alavi
> Office 818 737-0526
> Cell 818 402-1987
>
> The information contained in this message and any attachments is intended
> only for the use of the individual or entity to which it is addressed, and
> may contain information that is PRIVILEGED, CONFIDENTIAL and exempt from
> disclosure under applicable law. If you have received this message in
error,
> you are prohibited from copying, distributing, or using the information.
> Please contact the sender immediately by return e-mail and delete the
> original message from your system.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Hamid Alavi
> INET: hamid.alavi_at_quovadx.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Igor Neyman
  INET: ineyman_at_perceptron.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
The information contained in this message and any attachments is intended
only for the use of the individual or entity to which it is addressed, and
may contain information that is PRIVILEGED, CONFIDENTIAL and exempt from
disclosure under applicable law. If you have received this message in error,
you are prohibited from copying, distributing, or using the information.
Please contact the sender immediately by return e-mail and delete the
original message from your system.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Hamid Alavi
  INET: hamid.alavi_at_quovadx.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Feb 04 2002 - 12:11:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US