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

Thread Solved

Join Date: Feb 2008
Posts: 2
Reputation: culbysl is an unknown quantity at this point 
Solved Threads: 0
culbysl culbysl is offline Offline
Newbie Poster

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

 
0
  #1
Jun 14th, 2009
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:

  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:

  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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,082
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 124
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

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

 
0
  #2
Jun 16th, 2009
the syntax that you are using is not Oracle syntax.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 2
Reputation: culbysl is an unknown quantity at this point 
Solved Threads: 0
culbysl culbysl is offline Offline
Newbie Poster

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

 
0
  #3
Jun 16th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: arjun0 is an unknown quantity at this point 
Solved Threads: 0
arjun0 arjun0 is offline Offline
Newbie Poster
 
0
  #4
34 Days Ago
hi i have error ora-00922(missing or invalid option) while creating this table
  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; 34 Days Ago at 7:05 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 118
Reputation: cgyrob is on a distinguished road 
Solved Threads: 18
cgyrob's Avatar
cgyrob cgyrob is offline Offline
Junior Poster
 
0
  #5
34 Days Ago
@arjun0 - If you want your questions answered you need to start a new thread.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,082
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 124
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic
 
0
  #6
34 Days Ago
missing CONSTRAINT key word on line 8.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Oracle Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC