Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

murach's Oracle SQL and PL/SQL

 
John Paterson
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks...


I am totally new to Oracle SQL and PL/SQL. So I purchased the above mentioned e-book to learn. I seem to have some difficulty in getting somethings up and running, really hope someone can help.
As per the instruction given I downloaded and installed the necessary files. I ran the 'setup_database.bat'which was supposed to install all the tables and users. When I checked the log file, there are lines and lines of 'table created' and '1 row created' messages. I am curious as to what exactly did the 'setup_database.bat' file create? All I see when I open the file in notepad is this:

@ECHO off
:: Murach's Oracle SQL and PL/SQL
:: Mike Murach & Associates, Inc.
:: Jan 1, 2008
::
:: Uses SQL*Plus utility to run the SQL scripts that create
:: and populate the tables in the AP, OM, and EX schemas.

:: If necessary, edit the username/password
sqlplus system/system @setup_database

:: Display a message about the log file
ECHO.
ECHO For details, check the setup_database.log file in the current directory.
ECHO.

:: Display 'press any key to continue' message
PAUSE


Really hope someone can advise. Thanks.


regards
John
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The BAT file does not contain actual SQL statements, it merely runs statements stored in an SQL script file. There should be a file named setup_database (or perhaps setup_database.sql), according to the contents of the BAT file you've posted. Try to find and have a look into that file.
 
John Paterson
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Martin Vajsar

Yes, there is a setup_database.sql file and it's contents are as follow:

spool setup_database.log;

prompt>Creating users/schemas
start create_users

prompt>Creating AP tables
start create_ap_tables

prompt>Creating OM tables
start create_om_tables

prompt>Creating EX tables
start create_ex_tables

spool off;

exit;


Infact in the same folder there are another three sql files: create_ap_tables, create_ex_tables, create_om_tables. The excerises in the book refer to these tables and it seems all these tables should be created when the batch file is invoked, but nothing seems to happen. How and where do I check to see if the tables have actually been created?

regards
John
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The START command executes the given SQL script and then returns. It is similar to calling a subroutine. Inspect the files referenced by the START command (recursively if need be), you'll reach the real SQL statements eventually.

Edit: you mentioned the log file contains lines like table created; this indicates some tables were indeed created by the script. If there was an error, you'd most probably see ORA-XXXXX (XXXXX being a number) in the log file. Try to search for "ORA-" text in the log file, if you don't find such text, most probably the script has run without any error.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw from your other post that you are using SQL Developer. Use it to connect to the database, and you should be able to see the created tables.
 
John Paterson
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Managed to solve the problem. I was logging in with the default password when in sqlplus, as opposed to the password already determined by the scripts, hence all these problems of not being able to see the database. When in SQL developer, I was also using the default password to make the 'Connections' as opposed to one provided by the scripts. I am now using the correct passwords, I am able to see the databases and their tables. Thanks guys.

regards
John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic