ORA-00907: missing right parenthesis, What could be the problem? [closed] - oracle

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I try to add a constraint , but it gave me the error
ORA-00907: missing right parenthesis
What could be the problem?
CREATE TABLE "BDCOMEARE"."PILOTE" (
"matrPlt" INTEGER NOT NULL ,
"nomPlt" VARCHAR2(50) ,
"prenomPlt" VARCHAR2(50) ,
"gradePlt" VARCHAR2(100) ,
"adressePlt" VARCHAR2(100) ,
"salairePlt" NUMBER(10,2) ,
"dateEmbauche" DATE ,
PRIMARY KEY ("matrPlt")
)
ALTER TABLE PILOTE ADD CONSTRAINT check_gradePlt
CHECK (gradePlt IN 'commandantBord', 'assistantBord','officier');

Just that you need brackets after IN clause
CONSTRAINT check_gradePlt CHECK (
gradePlt IN ('commandantBord', 'assistantBord', 'officier')
);

Related

Oracle: Create Table [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to create table and I try did it as following:
And when I try execute this query I get an error
There is a comma missing before "CONSTRAINT". So for Database it seems like you are creating constraint on a column "waktu_selesai" (the last one) whereas you need to create a table-level constraint in order to make this thing work.
create table jadwal(
id_jadwal number generated always as identity primary key,
hari varchar2(10),
waktu_mulai varchar2(5) not null,
waktu_selesai varchar2(5) not null,
constraint jadwal_check_waktu check (to_number(substr(waktu_mulai, 1, 2)) > to_number(substr(waktu_selesai, 1, 2)))
);

invalid trigger specification in oracle [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
DROP TABLE a CASCADE CONSTRAINTS;
CREATE TABLE a(
cyear VARCHAR2(4));
CREATE TRIGGER current_year
BEFORE INSERT ON cyear
FOR EACH ROW SET NEW.year = year(NOW());
EDIT:
I tried this,
CREATE TRIGGER current_year
BEFORE INSERT ON a
FOR EACH ROW
BEGIN
:NEW.cyear = TO_CHAR(SYSDATE, 'YYYY');
END current_year;
I keep getting the PLS-00103 error.
Trigger created on tables, not on columns
In Oracle variables are not assigned with SET
There is no build-in function called NOW in Oracle
NEW and OLD are accessible only in WHEN clause; in other places they should be preceded by colon (:NEW, :OLD)
END keyword is missed at the end (and BEGIN in the beginning of the trigger body)

Why do I get ORA:0922 error:missing or invalid option [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Whats wrong with the following procedure?? I have checked the code for syntax errors but I m unable to find one.
CREATE OR REPLACE Edit_premium_amt
(
policy_number IN number(4),
new_premium_type IN varchar2(4)
)
IS
discount_amount number(6,2);
premium_amts number(11,2);
policy_amts number(11);
dur number(5);
prem_type varchar2(4);
disc_weigh varchar2(2);
disc_perc number(2);
prem_type_int number(2,1);
BEGIN
prem_type:=new_premium_type;
UPDATE policy SET premium_type=new_premium_type WHERE policy_id=policy_number;
SELECT policy_amt,duration INTO policy_amts,dur WHERE policy_id=policy_number;
SELECT disc_weightage INTO disc_weigh FROM disc_details WHERE duration=dur;
SELECT percent INTO disc_perc FROM disc_calculation WHERE premium_type=prem_type AND
weightage=disc_weigh;
CASE prem_type
WHEN 'HY' THEN prem_type_int:=2.0;
WHEN 'Y' THEN prem_type_int:=1.0;
ELSE prem_type_int:=0.5;
END CASE;
discount_amount:= ((policy_amts)/dur)/prem_type_int))*disc_perc;
premium_amts:=policy_amts-discount_amount;
UPDATE policy SET premium_amt=premium_amts
WHERE policy_id=policy_number;
END Edit_premium_amt;
You must say what you are creating or replacing
In this case CREATE OR REPLACE PROCEDURE Edit_premium_amt............

Unable to insert date to table [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm trying to insert a date into oracle table using below
SQL> insert into temp (tst,thistime) values ('test3',TO_DATE('MM/DD/YYYY HH24:MI
:SS','01/01/2014 16:45:45') );
but its giving below error
ERROR at line 1:
ORA-01821: date format not recognized
Below is the description of table
SQL> describe temp;
Name Null? Type
----------------------------------------- -------- ---------------------------
TST VARCHAR2(10)
THISTIME DATE
Use the insert . . . select form of insert:
insert into temp (tst, thistime)
select 'test3', TO_DATE('01/01/2014 16:45:45', 'MM/DD/YYYY HH24:MI:SS')
from dual;
In addition to having the arguments backwards for to_date(), values doesn't evaluate expressions that belong in a select statement.

Trying to create a table, but it comes up with this error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am new to mysql and I can't really figure out as to why I keep on getting the missing right parenthesis error from this code:
/*second oracle program */
/*Franklin Tong */
set echo on
spool c:hw3.text
drop table student;
create table student(
snn char(9),
lastname char(10),
firstname char(10),
major char(10),
GPA number(3,2)
DOB date
);
insert into student (111,Smith,Johnny,IS,3.41,5/18/82);
insert into student (102,Smith,Jack,FIN,3.25,3/11/80);
select * from student;
spool off
system returns a message saying:
error at line 7
ora-00907: missing right parathesis
You are missing a ',' after 'GPA number(3,2)'.
You should put a comma ',' after 'GPA number(3,2)'.

Resources