PL/SQL Help!!!# Database - 数据库
r*e
1 楼
For some reason, the following code does not work:
DECLARE
Comp_id NUMBER;
Comp_name CHAR(20) := 'ACME SHOWERS';
BEGIN
SELECT company_id_seq.NEXTVAL INTO comp_id
FROM dual;
INSERT INTO company (company_id, company_name)
VALUES (comp_id, comp_name);
END;
It seems that I can not use the Comp_id directly because when I change comp_id
to some real data, it works.
DECLARE
Comp_id NUMBER;
Comp_name CHAR(20) := 'ACME SHOWERS';
BEGIN
SELECT company_id_seq.NEXTVAL INTO comp_id
FROM dual;
INSERT INTO company (company_id, company_name)
VALUES (comp_id, comp_name);
END;
It seems that I can not use the Comp_id directly because when I change comp_id
to some real data, it works.