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: Some questions from database newbie

Re: Some questions from database newbie

From: John Durst <jdurst_at_sky.net>
Date: Fri, 16 Oct 1998 22:07:16 -0500
Message-ID: <362809E4.5F2D20D9@sky.net>

Thomas M. Payerle wrote:
1) The existing database code makes reference to a table sys.dual. I can't...

Dual is a table to do just as you described. The "column" user is what is called a pseudocolumn. The DUAL table is just a table that you know has only one row, and is therefore used to query the pseudocolumns like user and sysdate.2) After spending close to an hour trying to enter a stored procedure in...SQL commands are terminated by a semicolon. Since PL/SQL blocks can contain more than one SQL command, they are terminated by a slash on a line by itself. SQL*Plus commands themseleves (e.g., set pause on) are terminated by the end of line character, and can span lines by ending the line with a dash (-). Putting a period (.) on a line by itself ends the entering of a SQL command or PL/SQL block into the SQL buffer, but does not execute the command. Putting a slash on a line by itself will execute/reexecute the statement in the SQL buffer.

3) In my crash recovery, it seems that a sequence that was used to ensure the...

Not exactly sure what happened here, but I didn't really ponder it for too long. What's important is how to resolve the issue. Since dropping and recreating the sequence requires pulling information out of the data dictionary to determine grants on it, altering the sequence is a better alternative. Just make sure noone else is referencing it when you alter it. I have always had to set the sequence to the next available one based on the table data and have created a simple PL/SQL anonymous block to do it. Something like:

declare
  max_key table.pk%type;
  curr_key table.pk%type;
begin
  select max(pk) into max_key from table;   select sequence.nextval into curr_key from DUAL;   while (curr_key <= max_key) loop
    select sequence.nextval into curr_key from DUAL;   end loop;
end;
/ Received on Fri Oct 16 1998 - 22:07:16 CDT

Original text of this message

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