Questions about the use of semicolons

Database
Enthusiast

Questions about the use of semicolons

Greetings,

 

I am new to TeraData. I know in oracle you specify a semicolon at the end of a statement "or I beilive you do anyways". When is this required in SQL assistant or in Teradata Studios? I tried a two table join in teradata studios and the query wouldnt run. It was giving an error on the join condition which I didnt understand because it was correct. I added a semicolon at the end of the query then it worked. However It looks like I didnt have to use it in SQL assistant. I applogize if this does not make sense maybe I am just confused.

 


Accepted Solutions
Senior Apprentice

Re: Questions about the use of semicolons

Hi,

 

Both SQL Assistant and TDStudio will silently add a semi-colon to the end of the sql that it is running. So you don't need to add it.

 

TD Studio parses the sql that you type into an sql editor window and will mark it as 'invalid' if there is no semi-colon, however (as you've spotted) the sql will run.

 

Where you do need a semi-colon is between two statements, if you want the tool to run both of them in sequence.

 

So the following will produce an error:

 SEL *
 FROM dbc.dbcinfov
 
 SEL *
 FROM dbc.tablesv
 WHERE databasename = 'xyz'

...because there is no semi-colon between the two statements.

 

The following will run ok:

 sel *
 from dbc.dbcinfov;
 
 sel *
 from dbc.tablesv
 where databasename = 'xyz'

HTH

Dave

 

 

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
1 ACCEPTED SOLUTION
3 REPLIES
Enthusiast

Re: Questions about the use of semicolons

Any ideas?

Senior Apprentice

Re: Questions about the use of semicolons

Hi,

 

Both SQL Assistant and TDStudio will silently add a semi-colon to the end of the sql that it is running. So you don't need to add it.

 

TD Studio parses the sql that you type into an sql editor window and will mark it as 'invalid' if there is no semi-colon, however (as you've spotted) the sql will run.

 

Where you do need a semi-colon is between two statements, if you want the tool to run both of them in sequence.

 

So the following will produce an error:

 SEL *
 FROM dbc.dbcinfov
 
 SEL *
 FROM dbc.tablesv
 WHERE databasename = 'xyz'

...because there is no semi-colon between the two statements.

 

The following will run ok:

 sel *
 from dbc.dbcinfov;
 
 sel *
 from dbc.tablesv
 where databasename = 'xyz'

HTH

Dave

 

 

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
Enthusiast

Re: Questions about the use of semicolons

Thank you sir!