944,124 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Marked Solved
  • Views: 6026
  • Oracle RSS
Jun 14th, 2009
0

PL/SQL: ORA-00922: missing or invalid option

Expand Post »
I am new at oracle and working on a small project. I am trying to find "[" in a field and produce from that point to the end of the field.

My code is as follows:

Oracle Syntax (Toggle Plain Text)
  1. DECLARE
  2. startPos PLS_INTEGER;
  3. endPos PLS_INTEGER;
  4.  
  5. BEGIN
  6.  
  7. SET startPos := (SELECT top 1(INSTR(description, '[', 1, 1)-1) FROM INSTRTEST);
  8.  
  9. dbms_output.put_line(startPos);
  10.  
  11. END;

The error I am receiving:

Oracle Syntax (Toggle Plain Text)
  1. ORA-06550: line 5, COLUMN 5:
  2. PL/SQL: ORA-00922: missing OR invalid OPTION
  3. ORA-06550: line 5, COLUMN 1:
  4. PL/SQL: SQL Statement ignored
  5.  
  6. 3. endPos PLS_INTEGER;
  7. 4. BEGIN
  8. 5. SET startPos := (SELECT top 1(INSTR(description, '[', 1, 1)-1) FROM INSTRTEST);
  9. 6. --endPos := (select len(description)FROM INSTRTEST)
  10. 7. dbms_output.put_line(startPos);

Thanks in advance for any help available.
culbysl
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
culbysl is offline Offline
2 posts
since Feb 2008
Jun 16th, 2009
0

Re: PL/SQL: ORA-00922: missing or invalid option

the syntax that you are using is not Oracle syntax.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Jun 16th, 2009
0

Re: PL/SQL: ORA-00922: missing or invalid option

Thanks for your reply debasisdas. I see the mistake is selecting the top N. SQL Server habits are hard to overcome. Again thanks for your reply.

culbysl
Reputation Points: 10
Solved Threads: 0
Newbie Poster
culbysl is offline Offline
2 posts
since Feb 2008
Oct 20th, 2009
0
Re: PL/SQL: ORA-00922: missing or invalid option
hi i have error ora-00922(missing or invalid option) while creating this table
sql Syntax (Toggle Plain Text)
  1. CREATE TABLE emp5
  2. (
  3. empno varchar2(6) CONSTRAINT che_emp CHECK(empno IN('A%','M%','P%','S%')),
  4. ename varchar2(10) CONSTRAINT en_nn NOT NULL,
  5. dob DATE CONSTRAINT dob_che
  6. CHECK(to_char(dob,'dd-mon-yyyy')<'01-jan-1983'),
  7. sex CHAR CONSTRAINT se_che CHECK(sex IN('m','f','M','F')),
  8. salary number(10,2) sal_che
  9. CHECK( salary BETWEEN 15000 AND 100000),
  10. CONSTRAINT pk_empno PRIMARY KEY(empno)
  11. );
Last edited by peter_budo; Oct 20th, 2009 at 7:05 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
arjun0 is offline Offline
1 posts
since Oct 2009
Oct 20th, 2009
0
Re: PL/SQL: ORA-00922: missing or invalid option
@arjun0 - If you want your questions answered you need to start a new thread.
Reputation Points: 91
Solved Threads: 18
Junior Poster
cgyrob is offline Offline
125 posts
since Sep 2008
Oct 21st, 2009
0
Re: PL/SQL: ORA-00922: missing or invalid option
missing CONSTRAINT key word on line 8.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: INSERT sql statement for DateTime
Next Thread in Oracle Forum Timeline: outputting too many





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC