sql plus script file
Download
Skip this Video
Download Presentation
SQL*Plus Script File

Loading in 2 Seconds...

play fullscreen
1 / 8

SQL*Plus Script File - PowerPoint PPT Presentation


  • 97 Views
  • Uploaded on

SQL*Plus Script File. SQL*Plus editor can have only one SQL command Insert command inserts only one record at a time Use Oracle script file A program in SQL. Creating SQL*Plus Script File. DO NOT use Oracle editor to create script file Use any Test editor such as NotePad or .NET

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' SQL*Plus Script File' - shalin


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
sql plus script file
SQL*Plus Script File
  • SQL*Plus editor can have only one SQL command
  • Insert command inserts only one record at a time
  • Use Oracle script file
  • A program in SQL
creating sql plus script file
Creating SQL*Plus Script File
  • DO NOT use Oracle editor to create script file
  • Use any Test editor such as NotePad or .NET

File extension: *.sql

DOS file name conversion: no space

Multiple SQL commands

Use semicolon at the end of each command

change the working folder
Change the Working Folder
  • SQL*Plus has a default working folder

We may not have full rights in the folder

  • Change the working folder

File menu

Open…

Browse to the folder (J:\CS 3630\Oracle)

Select a file (Lab7.sql)

Open

  • This does not execute the script file

You could get an error message

Enter to get SQL*Plus prompt

execute script file
Execute Script File
  • Make sure the script file is in the working folder
  • Execute SQL script file

@Lab7

@Lab7.SQL

  • Do not use command run!
dropping tables before creating
Dropping Tables before Creating
  • Cannot create a table if a table with the same name exists in the database

Drop table test1;

-- You may get an error message

-- Since no table exists

Create table test1 (

parent and child tables
Parent and Child Tables

Drop table test2;

Drop table test1;

create table test1(

c1 char(4) primary key,

…);

Create Table test2(

b1 char(4) references test1(c1),

b2 integer);

script file style
Script File: Style
  • File Header

Full Name

UserName

Date

Course

  • Add some comments
  • Blank lines to separate commands
  • Each line is not too long
  • Alignment
  • Different clauses on separate lines
example
Example

OraclePlus.sql

SQL*Plus command Pause

Enter to continue

ad