• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

IBM DB2 help: How do I run multiple-line commands from the UNIX command shell?

yllus

Elite Member & Lifer
I'd like to execute the following SQL, along with a bunch of other table definitions, in IBM DB2. The problem is I have to do it from the *NIX command line, and DB2 doesn't seem to wait for a semicolon to execute a command. Is there a way around this?

--

CREATE TABLE employee
(emp_num INTEGER GENERATED ALWAYS AS IDENTITY,
emp_lastname VARCHAR(50),
emp_firstname VARCHAR(50),
emp_sin INTEGER,
emp_phonenum INTEGER,
emp_emergphonenum INTEGER,
emp_address VARCHAR(100))
 
Originally posted by: ggavinmoss
How about "GO"? Some command line DB programs waith for that as a statement seperator.

-geoff
I'd like to set an option to make it wait for me to specify I want it to execute, but it executes anytime I press Enter anyways!
Originally posted by: Ameesh
ummm, put it all on one line?
Doable of course, but really I shouldn't have to do something as lame as that. 😛
 
Oh. Try "\" at the end of every line -- I think it lets the shell know you're going to type more.

I could be wrong though.

-geoff
 
Well slap my ass and call me Tinklebell. I found an option that lets me set the semicolon, or anything else, as a statement termination character...

DB2 -t Set statement termination character OFF

Example usage (from the *NIX command shell):

db2 -t ;

The above sets the termination character to the semicolon.
 
Back
Top