Oracle Live SQL

Background

Needing to test out a Table creation script before posting it online.
SQL Server is easy, but not so much Oracle.

And, so googled for free online Oracle DB playground.

Oracle Live SQL

URL

Oracle Live SQL is available here.

Here is my welcome screen.

Account

Previous Account

Tried to use an old Oracle account that I have from yester years, but no go.

New Account

Signed up for a new Account.

Got sent an email and confirmed it is mine.

 

SQL

Sample SQL

Here is my sample SQL:


declare 
           numberofTableMatches number  := 0;
           objectName VARCHAR2(60);
           sqlStatement VARCHAR2(255);
           sqlMessage_ VARCHAR(255);
           
           table_name_ VARCHAR(60);

begin

  numberofTableMatches := 0;
  objectName := 'MetaStage_Loc_Info';

  SELECT count(*) 
  into   numberofTableMatches
  FROM   USER_TABLES
  where  (
                ( table_name = objectName )
            or  ( table_name = upper(objectName) )
        )    
  ;
  
  
  
  sqlMessage_ := 'numberofTableMatches ' ||  numberofTableMatches || '';
      
  dbms_output.put_line(sqlMessage_);  
  IF (numberofTableMatches = 10) THEN
  
      sqlStatement := '
create table MetaStage_Loc_Info
(
     Computer			VARCHAR2(64)
   , SoftwareProduct	VARCHAR2(64)
   , DataStore			VARCHAR2(64)
   , DataSchema		VARCHAR2(64)
)';

      
      dbms_output.put_line('Executing SQL pasted below :');
      
      dbms_output.put_line(sqlStatement);
      
      execute immediate sqlStatement;
      
      dbms_output.put_line('Executed SQL:');

  ELSE
  
      sqlMessage_ := 'Table (' || objectName || ') exists';
      
     dbms_output.put_line(sqlMessage_);
      
  END IF ;

end;

 

Image

 

Save Session

 

 

Saved Session

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s