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

Home -> Community -> Usenet -> c.d.o.misc -> Re: how to change dynamically field name when using recordtype

Re: how to change dynamically field name when using recordtype

From: Basant <basantshanker_at_hotmail.com>
Date: 22 Feb 2004 23:00:23 -0800
Message-ID: <e3fbec7a.0402222300.46eca026@posting.google.com>


Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1077299808.209216_at_yasure>...
> Basant wrote:
>
> > Hi,
> > I want to change the field name of a recordtype dynamically to
> > compare two values. For Example.
> >
> > TYPE Rec IS RECORD (name VARCHAR2(300),
> > Roll NUMBER);
> > Student Rec;
> >
> > FUNCTION isEqual (l_Student Rec,
> > ColumnName VARCHAR2,
> > Value VARCHAR2)
> > BEGIN
> > IF 'l_Student'||Columnname = Value THEN
> > RETURN TRUE;
> > ELSE
> > RETURN FALSE;
> > END IF;
> > END;
> >
> > Calling funciton as :
> > l_Student Rec;
> > BEGIN
> > l_Student.Name:='JOHN';
> > isEqual(l_student,'.Name','JOHN');
> > END;
> >
> > I have already tried with Dynamic SQL . But didn't got any option to
> > do like this.
> >
> >
> > Help me out...
> >
> > Thanks in Advance.
> > Basant
>
> Help you out with what? You provided no version or edition information
> and no error message or indication of what is wrong.
>
> But the first thing I'd do is:
>
> SELECT keyword FROM v$reserved_words
> WHERE keyword LIKE 'NA%';
>
> SELECT keyword FROM v$reserved_words
> WHERE keyword LIKE 'RO%';

Hi,

   I am using client : " SQL*Plus: Release 9.0.1.3.0" and server version is : "Oracle9i Enterprise Edition Release 9.2.0.1.0".

      In above case i am getting wrong result i.e. function return 'FALSE', whereas it should return 'TRUE'. I tried to trace and find that the

   IF condition " 'l_Student'||Columnname " of define FUNCTION "isEqual" is treated as string . It is not assigning the passed value "JOHN".
           I want to know that , is there any way to assign the proper value in this case?

        Let me know if any addition info reqd. Received on Mon Feb 23 2004 - 01:00:23 CST

Original text of this message

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