Oracle Error Case: ORA-00922

Source: Internet
Author: User
Tags date expression numeric numeric value readable variable oracle database

ORA-00922 missing or invalid option
0ra-00922: Missing or invalid option

cause An invalid option is specified in defining a column or storage clause. The valid option in specifying a, NOT NULL to specify, the column cannot contain any NULL values. Only constraints may follow the datatype. Specifying a maximum length on a DATE or LONG datatype also causes this error.

Action Correct the syntax. Remove the erroneous option or length specification from the column or storage specification.

Case one: Oracle plaintext Password vulnerability

Affected Systems:

Oracle oracle10g Application Server 9.0.4.0
Oracle oracle10g Application Server 10.1.0.2
Describe:

Oracle database is a large, commercial, and data-base system.

Oracle 10g has a global readable file containing plaintext passwords that can be exploited by local attackers to gain access to the database.

The password for the Sysman account can be obtained in the ' $ORACLE _home/hostname_sid/sysman/config/emoms.properties ' file, which is globally readable.

In addition, if you install Oracle 10g with the same password for sys, SYSTEM, DBSNMP, and Sysman accounts, and the password has an exclamation point (such as f00bar!!), the DB installation error occurs when you set the Sysman and DBSNMP password, error message " PostDBCreation.log will record the password:

Alter user Sysman identified by f00bar!! Account unlock
ERROR at line 1:
ora-00922:missing or Invalid option

Alter user DBSNMP identified by f00bar!! Account unlock
ERROR at line 1:
ora-00922:missing or Invalid option

<* Source: David Litchfield (david@nextgenss.com)

Link: http://marc.theaimsgroup.com/? l=bugtraq&m=110382247308064&w=2
*>

Suggestions:

Vendor Patch:

Oracle
------
Oracle has released patch (#68) to fix this vulnerability:

http://metalink.oracle.com/

Case two: permutation variables

I just started using Oracle's products, and I ran into a problem executing the following two commands: ACCEPT and prompt. I've changed the order of the rows, sometimes in char, sometimes deleted, sometimes in prompt, sometimes deleted. No matter what I do or I get an error message. I've even tried to put accept and prompt before and after the begin.
The thing I want to do is this. At the beginning of the script, I read the start and end dates from the keyboard, and then in the main part of the program, I use Select to read from a table and test to see if the date is between two dates that the keyboard entered. Now when I execute/compile the script in Sql*plus, the error message I get is ORA-00922.

PROMPT
ACCEPT in_beg_date PROMPT ' Enter beginning extract date Mm/dd/yy '
PROMPT
ACCEPT in_end_date PROMPT ' Enter ending extract date mm/dd/yy '
DECLARE
Beg_date VARCHAR2 (8): = &in_beg_date;
End_date VARCHAR2 (8): = &in_end_date;
Beg_dte DATE;
End_dte DATE;
...
BEGIN
Beg_dte: = To_date (beg_date, ' mm/dd/yy ');
End_dte: = To_date (end_date, ' mm/dd/yy ');
...
IF (outrec_abs_date >= beg_dte and <= end_dte) THEN
...

To be honest, it seems that you have a good understanding of prompt and ACCEPT. PROMPT tells Sql*plus to write a line of text on the screen. You've used two prompt commands here; each command prints a blank line on the screen, which is good for vertical spacing. The Accept command is a value that waits for the user to enter a permutation variable. The optional prompt clause in the Accept command displays a message in the same row as the user enters a value. You are right to place prompt and ACCEPT outside the Pl/sql block: They are sql*plus orders, not pl/sql.

You may notice that when you run this script, each row that has a permutation variable causes two lines of output on the screen, such as:
Old 3:beg_date VARCHAR2 (8): = &in_beg_date;
New 3:beg_date VARCHAR2 (8): = 09/01/03;

This shows how Sql*plus works when he sees a line of code that includes a permutation variable: He replaces the variable's name with the value of the variable (starting with &). It's like you're replacing each occurrence of a string (here is &in_beg_date) with another string (09/09/03) in a text editor, such as Notepad, with a lookup and a permutation. The "original" line is in the code. The "new" line is the way it will be executed. If you perform the "Beg_date VARCHAR2 (8): = 09/01/03;" Statement, what happens? Sql*plus creates a string variable and initializes it with a numeric value to the right of ": =". In this case, it is a numeric expression, then Sql*plus detects the expression "(9/1)/3" and writes the answer as ' 3 '. What you actually mean is:

Beg_date VARCHAR2 (8): = ' &in_beg_date ';
End_date VARCHAR2 (8): = ' &in_end_date ';
Single quotes are essential.

This article International Source:http://searchoracle.techtarget.com/



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.