pl/sql variable question
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: pl/sql variable question

  1. #1
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187

    pl/sql variable question

    a snippet of code from the honorable tom kyte

    wft is x$alert_log$x ?

    It appears it's built as a variable but I am not familiar with how this is done......

    tks

    steve

    create or replace procedure load_alert
    as
    l_background_dump_dest v$parameter.value%type;
    l_filename varchar2(255);
    l_bfile bfile;
    l_last number;
    l_current number;
    l_start number := dbms_utility.get_time;
    begin
    select a.value, 'alert_' || b.instance || '.log'
    into l_background_dump_dest, l_filename
    from v$parameter a, v$thread b
    where a.name = 'background_dump_dest';

    execute immediate
    'create or replace directory x$alert_log$x as
    ''' || l_background_dump_dest || '''';


    dbms_output.put_line( l_background_dump_dest );
    dbms_output.put_line( l_filename );

    delete from alert_log;
    I'm stmontgo and I approve of this message

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439

    Re: pl/sql variable question

    Originally posted by stmontgo
    wft is x$alert_log$x ?
    It's simply the name of the database object (directory, in this case) that procedure will create or replace during its execution. It's not a variable, it's nothing that's built in (depite the X$ part in the name), it is simply the name for the database directory that Tom has chosen.

    If the code would read
    Code:
    ....
    execute immediate
    'create table x$alert_log$x (col1 number)';
    ....
    then the procedure would create a table with the name X$ALERT_LOG$X. In the original case it creates a directory with that name. It is simply a hardcoded name of the database object that will be created. Is it "X$" or "$X" part in the name that confuses you?
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187
    ah ok, so no hocus pocus after all, just a standard name displayed in a manner that threw me for a loop,

    tks for your help

    steve
    I'm stmontgo and I approve of this message

  4. #4
    Join Date
    May 2002
    Posts
    2,645
    "Sometimes, a cigar is just a cigar."

    --Sigmund Freud

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