Question

I am taking a database class and we are using oracle sqlplus. I have worked with many different database management systems before and several different flavors of SQL but I am having trouble doing something incredibly simple it would seem. I am trying to use the editor in sqlplus by typing into sqlplus SQL> ED, which works but then I can't find any way to save the file once I am done writing my script. I'm sure this is incredibly simple but it's hard to find anything online that tells how to save a file once you are in the editor. I am just trying to copy and paste my script in from notepad basically and save it using the editor so I can run it to create several tables at once.

Was it helpful?

Solution

You can save it as script.sql and then run it using sqlplus @script.sql.

For example echo "SELECT * FROM table" > script.sql and then sqlplus user/pass@db @script.sql.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top