Re: create table issue

  • From: Onkar N Tiwary <onkarnath.tiwary@xxxxxxxxx>
  • To: Carel-Jan Engel <cjpengel.dbalert@xxxxxxxxx>
  • Date: Wed, 29 Jun 2005 12:57:12 +0530

Superb explanation Carel,
 Ur explaination with example cleared all my doubts in this regards.
 Thanx once again

 On 6/29/05, Carel-Jan Engel <cjpengel.dbalert@xxxxxxxxx> wrote: 
> 
> You won't, but you probably don't need to.
> 
> To explain, you need some background about how a compiler/parser works. 
> There are roughly two parts involved in analyzing the text of the statement. 
> The first part is the lexical analyzer. This will identify strings of 
> characters as individual tokens. There are a lot of different tokens. You 
> have the reserved words, numbers, braces, and so on. Tokens can be just the 
> token on its own, an internal representation used by lexical analyzer and 
> parser, or can be accomanied by a value, which is the case for e.g. 
> numbers and strings. After lexical analysis, the parser well get handed over 
> the token from the lexical aqalyzer. 
> Take the next statement for example:
> 
> CREATE TABLE XYZ(SR INTEGER);
> The tokens are:
> CREATE
> TABLE
> STRING "XYZ"
> BRACE_OPEN
> STRING "SR"
> INTEGER
> BRACE_CLOSE
> SEMICOLON
> 
> Every known ("RESERVED") word will be translated in an internal 
> representation of a token. In this example XYZ and SR are unknown words, and 
> will therefor be transferred as STRING token to the parser. A STRING token 
> is accompanied with a value, "XYZ" or "SR" and this example. The parser will 
> then check the syntax to find out whether a string is appropriate on that 
> location in the statement. In this case the strings are OK: they represent 
> the table name and column name.
> 
> Now your example:
> 
> CREATE TABLE "TEST"(SR INTEGER);
> 
> The tokens are:
> CREATE
> TABLE
> STRING "TEST"
> BRACE_OPEN
> STRING "SR"
> INTEGER
> BRACE_CLOSE
> SEMICOLON
> 
> Normally, if "TEST" wouldn't have been enclosed the lexical analyzer will 
> hand over the representation for the token TEST to the parser. The effect of 
> enclosing TEST in quotes will be that the lexical analyzer sees the token 
> STRING, with a value of "TEST". This is OK for the parser, and it will enter 
> that string as a table name in the data dictionary.
> 
> 
> As you may see in the examples above, after the lexical analysis there is 
> no difference left in the treatment of "TEST" and "XYZ". Surrounding a 
> reserved word with quotes just prevents the lexical analyzer from 
> recognizing the reserved word. It will be treated as any other STRING.
> 
> In the datadictionary you will not find any sign of the quotes. They have 
> been lost during the lexical analysis phase already.
> 
> HTH.
> 
>   Best regards,
> 
> Carel-Jan Engel
> 
> ===
> If you think education is expensive, try ignorance. (Derek Bok)
> === 
> On Wed, 2005-06-29 at 07:41, Onkar N Tiwary wrote: 
> 
> *Hi Peter,
> 
> Nice method I must say. But what if a table has been created like this :
> 
> CREATE TABLE "TEST"(SR INTEGER);
> 
> In this case the table name is not the reserved word then how will one 
> identify this table as different from other tables created with normal 
> CREATE TABLE TEST(.....) command???
> 
> 
> On 6/28/05, **Peter.Hitchman@xxxxxxxxxxx* <Peter.Hitchman@xxxxxxxxxxx> <*
> Peter.Hitchman@xxxxxxxxxxx* <Peter.Hitchman@xxxxxxxxxxx>> wrote: 
> 
> Hi,
> There is a view v$reserved_words that lists all of the reserved words. So 
> you could use that to find tables/indexes etc created by surrounding the 
> identifier in double quotes.
> So I just tried it:-
> 
> create table "InserT" ( dummy char(1));
> 
> select owner, table_name
> from dba_tables d, v$reserved_words w
> where upper(keyword) = upper(table_name)
> 
> 
> ---> OWNER TABLE_NAME
> --------------- -----------------------------------
> OPS$PHITCHMA InserT
> 
> 1 row selected.
> 
> Regards
> 
> Pete
> 
> 
>  -----Original Message-----
> *From:* *oracle-l-bounce@xxxxxxxxxxxxx* 
> <oracle-l-bounce@xxxxxxxxxxxxx>[mailto:
> *oracle-l-bounce@xxxxxxxxxxxxx* <oracle-l-bounce@xxxxxxxxxxxxx>]*On Behalf 
> Of *Onkar N Tiwary
> *Sent:* 28 June 2005 14:16 
> *To:* Giovanni Cuccu
> *Cc:* *oracle-l@xxxxxxxxxxxxx* <oracle-l@xxxxxxxxxxxxx>
> *Subject:* Re: create table issue 
> 
> 
> hi Giovanni,
> 
> Thanx for the reply. But u know my main doubt is how to find such object 
> created using quotes. It must be recognised differently by oracle shand 
> there ould be entry for such object. If I am not wrong. I am trying to find 
> that method where in we can find such objects created using quotes. 
> 
> 
> On 6/28/05, *Giovanni Cuccu* 
> <*giovanni.cuccu@xxxxxxxxx*<giovanni.cuccu@xxxxxxxxx>> 
> wrote: 
> 
> Hi,
> I'm not a guru so my answer may be incorrect but I believe that
> Oracle implicitly use the uppercase name of your item (table, but also 
> column, etc) when try to reference it. If you want to give an item a
> "particular" name (as oracle 10g does with tables in the recyclebin)
> you must enclose it with duble quotes; this indicates that the name 
> should be taken as you typed it. You can find all the names (in the
> form required by Oracle for checking their existence) in the
> corresponding data_dictionary view (dba_tables for examples).
> Hope this helps,
> Giovanni
> 
> 
> On 6/28/05, Onkar N Tiwary <
> 
> *onkarnath.tiwary@xxxxxxxxx* <onkarnath.tiwary@xxxxxxxxx>> wrote:
> > Hi gurus, 
> >
> > Normally oracle says we can not create tables using the keywords but 
> when 
> > one issues CREATE TABLE "INSERT" (col datatype);", it gets created. It 
> can
> > always be referenced and other tasks can be done easily on the table but 
> the 
> > table name must always be in double quotes. My question is how oracle 
> > identifies these tables and where does makes the entry of such tables 
> for
> > regonising? If I don know about this double quotes and the table has 
> been 
> > created using double quotes then how to find such objects and from 
> > where?????
> >
> >
> > --
> > Thanks & Regards,
> > T. Onkar Nath
> > Ph : +91-9826728111(Cell)
> > *to_onkar@xxxxxxxxx* <to_onkar@xxxxxxxxx>
> > *onkarnath.tiwary@xxxxxxxxx* <onkarnath.tiwary@xxxxxxxxx>
> >
> 
> 
> --
> --------------------------------------------------------------------
> Another free oracle resource profiler
> *http://sourceforge.net/projects/oraresprof/*<http://sourceforge.net/projects/oraresprof/>
> New version 0.8 with many bug fixes
> and warnings on file truncated, timed_statistics=false, incorrect
> tracing deactivation and more 
> 
> 
> 
> 
> -- 
> Thanks & Regards,
> T. Onkar Nath
> Ph : +91-9826728111(Cell)
> *to_onkar@xxxxxxxxx* <to_onkar@xxxxxxxxx>
> *onkarnath.tiwary@xxxxxxxxx * <onkarnath.tiwary@xxxxxxxxx>
> 
> 
> 
> 
> 
> -- 
> Thanks & Regards, 
> T. Onkar Nath
> Ph : +91-9826728111(Cell)
> *to_onkar@xxxxxxxxx* <to_onkar@xxxxxxxxx>
> *onkarnath.tiwary@xxxxxxxxx* <onkarnath.tiwary@xxxxxxxxx>  
> 



-- 
Thanks & Regards,
T. Onkar Nath
Ph : +91-9826728111(Cell)
to_onkar@xxxxxxxxx
onkarnath.tiwary@xxxxxxxxx

Other related posts: