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

Home -> Community -> Usenet -> c.d.o.server -> Re: ticky sql

Re: ticky sql

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sun, 28 Nov 2004 13:06:20 -0800
Message-ID: <1101675887.932513@yasure>


Dmitri Priimak wrote:

> 
> 
> DA Morgan wrote:
> 

>> Dmitri Priimak wrote:
>>
>>> Hi All.
>>>
>>> I am very much new to Oracle. I am having a small problem. Let me
>>> explain. The queries bellow are meaningless but they do illustrate
>>> the problem. Let say I have a table name(id, name, fullname_lc)
>>>
>>> I can run this query:
>>>
>>> select (select name from name where id = n1.id) from name n1 where
>>> fullname_lc like 'fire.%';
>>>
>>> but when I try this one:
>>>
>>> select (select name from (select id, name from name where id = n1.id)
>>> where length(name) < 3 ) from name n1 where fullname_lc like 'fire.%';
>>>
>>> I get
>>> ERROR at line 1:
>>> ORA-00904: "N1"."ID": invalid identifier
>>>
>>> In other words if there are two levels of subselects I don't seem to
>>> be able to refer to the outer tables from the deepest subselect.
>>>
>>> The question is. Is there are way to do this?
>>>
>>> --
>>> Dmitri Priimak
>>
>>
>>
>> There is a way ... but why you are doing this is something else entirely.
> 
> 
> I need it :)
> 

>> However before you do ... try this query:
>>
>> SELECT keyword FROM v$reserved_words
>> WHERE keyword LIKE 'NA%';
> 
> 
> I get
> ORA-00942: table or view does not exist
> 
> Is this bad? Pardon my ignorance.
> 
> -- 
> Dmitri Priimak

Only means you don't have access to the view. Ask you DBA to grant you the necessary access ... or to perform the query for you.

The point is that you should never use reserved words for the names of objects, columns, or variables: And you did.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sun Nov 28 2004 - 15:06:20 CST

Original text of this message

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