Home » SQL & PL/SQL » SQL & PL/SQL » Silly question about PL/SQL queries
Silly question about PL/SQL queries [message #280463] Tue, 13 November 2007 13:59 Go to next message
timothyrcullen
Messages: 3
Registered: November 2007
Location: Laurel, MD
Junior Member
Dear all:

Good afternoon. I'm writing a console application using the .Net framework to query an Oracle 10g database infrastructure and have NO experience with Oracle, although I have a few years of SQL server under my belt.

The select statement is dynamic, with only the PM number being added to the original statement:

"SELECT TOP 1 PROBLEMM1.NUMBERPRGN, PROBLEMM1.ASSIGNMENT, INCIDENTSM1.PRIORITY_CODE, INCIDENTSM1.CLOSE_TIME FROM PROBLEMM1, INCIDENTSM1 WHERE PROBLEMM1.INCIDENT_ID = INCIDENTSM1.INCIDENT_ID AND PROBLEMM1.NUMBERPRGN = "PM00573988" ORDER BY PROBLEMM1.UPDATE_TIME DESC"

I've tried the query a number of different ways and continue to get the "00923: FROM keyword not found where expected" error. From what I've read from Google this appears because of a syntax error.

Any ideas on what I'm doing wrong? Thanks-TC
Re: Silly question about PL/SQL queries [message #280464 is a reply to message #280463] Tue, 13 November 2007 14:05 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
AFAIK, "TOP" is NOT valid with Oracle SQL
Re: Silly question about PL/SQL queries [message #280465 is a reply to message #280463] Tue, 13 November 2007 14:07 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Hi
SELECT TOP 1 ...

Is not how Oracle does a Top N query. (If you search these forums there are loads of examples.
Also string literals are delimited by apostrophes rather than quotes
Re: Silly question about PL/SQL queries [message #280469 is a reply to message #280463] Tue, 13 November 2007 15:02 Go to previous messageGo to next message
timothyrcullen
Messages: 3
Registered: November 2007
Location: Laurel, MD
Junior Member
Excellent-thanks for all the suggestions and direction. I'll continue my search for the answer.
Re: Silly question about PL/SQL queries [message #280487 is a reply to message #280469] Tue, 13 November 2007 19:44 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Also, you cannot enclose constant strings in double-quotes. Single quotes are the only valid option with Oracle.

Ross Leishman
Re: Silly question about PL/SQL queries [message #280540 is a reply to message #280487] Wed, 14 November 2007 01:07 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
rleishman wrote on Wed, 14 November 2007 01:44

Also, you cannot enclose constant strings in double-quotes. Single quotes are the only valid option with Oracle.

Ross Leishman


Pablo wrote

Also string literals are delimited by apostrophes rather than quotes

Potaito Potaato Smile
Re: Silly question about PL/SQL queries [message #280543 is a reply to message #280540] Wed, 14 November 2007 01:12 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
./fa/1587/0/

Waiting for LF to post a smilie with dark glasses doing a Stevie Wonder "sway"
Re: Silly question about PL/SQL queries [message #280583 is a reply to message #280543] Wed, 14 November 2007 02:44 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Laughing Gave me a laugh 1st thing in the AM, cheers

[Updated on: Wed, 14 November 2007 02:44]

Report message to a moderator

Re: Silly question about PL/SQL queries [message #280594 is a reply to message #280543] Wed, 14 November 2007 03:21 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hm? ./fa/3390/0/
Re: Silly question about PL/SQL queries [message #280602 is a reply to message #280463] Wed, 14 November 2007 03:40 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

There is no silly Question in the universe . All the questions have its own Seriousness .

Thumbs Up
Rajuvan.
Re: Silly question about PL/SQL queries [message #280633 is a reply to message #280602] Wed, 14 November 2007 05:00 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
There ARE silly questions.
Just as well as there are silly answers..

Not saying that the original question was a silly one!

[Updated on: Wed, 14 November 2007 05:00]

Report message to a moderator

Re: Silly question about PL/SQL queries [message #280639 is a reply to message #280463] Wed, 14 November 2007 05:14 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

I wont agree Mad

Rajuvan
Re: Silly question about PL/SQL queries [message #280641 is a reply to message #280639] Wed, 14 November 2007 05:22 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Hi Rajavu1
Why do we use select to select a column from a table insted of using insert?
Re: Silly question about PL/SQL queries [message #280650 is a reply to message #280463] Wed, 14 November 2007 05:37 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Yes.. One more NOT SILLTY Question .

Its because , Insert is for inserting and Select is for Selecting.

Really . It is not SILLY question . Its seriousness Increases when its converted to " Why SELECT only selects and INSERT only inserts ? "

Thumbs Up
Rajuvan.
Re: Silly question about PL/SQL queries [message #280667 is a reply to message #280463] Wed, 14 November 2007 07:49 Go to previous messageGo to next message
timothyrcullen
Messages: 3
Registered: November 2007
Location: Laurel, MD
Junior Member
Thanks for all the informative and colorful remarks!!! Once I replaced the "top" statement with a ROWNUM statement it worked like a charm. I just have to get used to the difference in syntax. Thanks again!! TC
Re: Silly question about PL/SQL queries [message #280673 is a reply to message #280667] Wed, 14 November 2007 08:24 Go to previous message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
Well, that depends on how you used the ROWNUM. Show us what you did as you may have used it incorrectly.
Previous Topic: How to get a current + last year data in a single record?
Next Topic: Dynamic Column Name
Goto Forum:
  


Current Time: Wed Dec 07 10:59:00 CST 2016

Total time taken to generate the page: 0.08910 seconds