Home > database >  Ora - 00984: listed here are not allowed to, and how to solve, o god
Ora - 00984: listed here are not allowed to, and how to solve, o god

Time:10-04

Scanner input=new Scanner (System. In);
The Connection conn=null;//said the database connection object
PreparedStatement PSTMT=null;//says database update operations
System. The out. Print (" please enter the name: ");
String name=input. Next ();
System. The out. Print (" please enter the age (age must be a number) : ");
Int the age=input. NextInt ();
System. The out. Print (" please enter the birthday: ");

The Date the Date=new Date (input. Next ());
System. The out. Print (" please enter the salary: ");
Float salary=input. NextFloat ();
String SQL="INSERT INTO person (pid, name, age, birthday, salary) VALUES (1 perseq nextcal,? ,? ,? ,?) ";
System. The out. Println (SQL);
Class.forname (DBDRIVER);
Conn=DriverManager. GetConnection (DBURL, DBUSER, DBPASS);
PSTMT=conn. PrepareStatement (SQL);//using pretreatment methods to create objects
PSTMT. SetString (1, name);//the first? The content of
PSTMT. SetInt (2, age);//the second? The content of
PSTMT. SetDate (3, new Java. SQL. The Date (the Date. The getTime ()));
PSTMT. SetFloat (4, salary);
PSTMT. ExecuteUpdate ();
PSTMT. Close ();
conn.close();
}
}
Please enter the name: zhang
Please enter the age (age must be a number) : 23
Please enter the birthday: 1994/4/03
Please enter the salary: 4000
INSERT INTO person (pid, the name, age, birthday, salary) VALUES (1 perseq nextcal,? ,? ,? ,?)
The Exception in the thread "main" Java. SQL. SQLSyntaxErrorException: ORA - 00984: listed here are not allowed to

At oracle, the JDBC driver. T4CTTIoer. ProcessError (T4CTTIoer. Java: 439)
At oracle, the JDBC driver. T4CTTIoer. ProcessError (T4CTTIoer. Java: 395)
At oracle, the JDBC driver. T4C8Oall. ProcessError (T4C8Oall. Java: 802)
At oracle, the JDBC driver. T4CTTIfun. The receive (T4CTTIfun. Java: 436)
At oracle, the JDBC driver. T4CTTIfun. DoRPC (T4CTTIfun. Java: 186)
At oracle, the JDBC driver. T4C8Oall. DoOALL (T4C8Oall. Java: 521)
At oracle, the JDBC driver. T4CPreparedStatement. DoOall8 (T4CPreparedStatement. Java: 205)
At oracle, the JDBC driver. T4CPreparedStatement. ExecuteForRows (T4CPreparedStatement. Java: 1008)
At oracle, the JDBC driver. OracleStatement. DoExecuteWithTimeout (OracleStatement. Java: 1307)
At oracle, the JDBC driver. OraclePreparedStatement. ExecuteInternal (OraclePreparedStatement. Java: 3449)
At oracle, the JDBC driver. OraclePreparedStatement. ExecuteUpdate (OraclePreparedStatement. Java: 3530)
At oracle, the JDBC driver. OraclePreparedStatementWrapper. ExecuteUpdate (OraclePreparedStatementWrapper. Java: 1350)
The at demo8. InsertDemo02. Main (InsertDemo02. Java: 36)
36 line is PSTMT executeUpdate ();

CodePudding user response:

Birthday column data type is DATE?

CodePudding user response:

Perseq. Nextcal? Sequence value?
Perseq. Nextval

CodePudding user response:

Floor of don't know how to reply, reply @ wmxcn2000, 1 l: database is turned off it's run: please enter a birthday: 1994/4/03, this is a date type? Reply @ jdsnhan, 2 l: VALUES of perseq. Nextcal transfer the content of the input is said to it

CodePudding user response:

Perseq. Nextcal should be corresponding pid value, look at the right

CodePudding user response:

You'll have to see the data types match, the data format is correct
  • Related