BookmarkSubscribeRSS Feed
FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hello Folks,

 

I stumbled upon a weird thing:

 

I am using the pass through facility in order to send a query to an ORACLE database and create a table.

 

When I run the second PROC SQL Statement in the picture below, it works fine:

Abfragen_SQL.JPG

 

However, when I run the upper PROC SQL Statement I get an error message, telling me the following:

 

"ORA-00933: SQL command not properly ended"

 

All I changed between the two PROC SQL Statements is that I assigned an ALIAS to the table WANT. Why does Oracle have trouble with this?

 

Any help from you guys would be much appreciated.

 

Thanks,

Felix

 

 

 

 

4 REPLIES 4
Astounding
PROC Star

A guess: 

 

When you supply an alias, SQL assumes that you will be reading from more than one source of data.  After all, why assign an alias if you are only reading from one source?  When SQL doesn't see a second source, it generates the error.

 

FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

@Astounding: Thank you for your answer, but I do not think this is the reason. When running the following SAS code

 

proc sql;
select A.height
from sashelp.class as A;
quit;

I do not get any error messages in the log. But of course this could also be related to the fact that the above statment is being processed locally and not by the means of the pass through facility....

 

Gegenbeispiel.JPG

Astounding
PROC Star

As you noted, it could be the pass-through feature.  Each SQL implementation has its own quirks.  Perhaps you could try a version of the successfully executing alias, but use that syntax directly on the pass-through system.

Ksharp
Super User

Yeah. Firstly you need make this SQL is a legal oracle SQL, talk to your oracle DBA.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1550 views
  • 0 likes
  • 3 in conversation