【发布时间】:2019-09-19 22:06:01
【问题描述】:
我已经在 Oracle 中定义了这个过程:
CREATE OR REPLACE Procedure InsertCliente
(dni IN VARCHAR, nombre IN VARCHAR, apellidos IN VARCHAR, apellido2 IN VARCHAR, direccion IN VARCHAR,
CALLE IN VARCHAR, NUMERO IN NUMBER, PISO IN VARCHAR, CIUDAD IN VARCHAR, CODPOSTAL IN NUMBER,
telefono IN NUMBER, edad IN DATE, email IN VARCHAR)
IS
claveDireccion number;
BEGIN
IF apellido2 is null THEN
INSERT INTO Cliente(DNI,Telefono,Direccion,Email,Edad,Apellidos,Nombre)
VALUES (dni,telefono,direccion,email,TO_DATE(edad,'YYYY-MM-DD'),apellidos,nombre);
ELSE
claveDireccion := (SELECT ID_DIRECCION FROM DIRECCION@SCHEMA2BD2 WHERE ID_DIRECCION=Direccion);
IF claveDireccion is not null THEN
INSERT INTO TITULAR@SCHEMA2BD2(DNI,Nombre,Apellido1, Apellido2, Direccion,Telefono,Fecha_Nacimiento)
VALUES (DNI,Nombre,Apellidos, Apellido2, Direccion,Telefono,TO_DATE(Fecha_Nacimiento,'YYYY-MM-DD'));
ELSE
raise_application_error(-20001, 'La direccion proporcionada no existe');
END IF;
END IF;
END;
/
但我从 Oracle 收到以下错误:
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/22 PLS-00103: Encountered the symbol "SELECT" when expecting one of
the following:
( - + case mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
13/96 PLS-00103: Encountered the symbol ")" when expecting one of the
following:
LINE/COL ERROR
-------- -----------------------------------------------------------------
. ( * @ % & - + ; / at for mod rem <an exponent (**)> and or
group having intersect minus order start union where connect
||
20/6 PLS-00103: Encountered the symbol "IF" when expecting one of the
following:
; <an identifier> <a double-quoted delimited-identifier>
delete exists prior <a single-quoted SQL string>
我不知道那里发生了什么。这只是一个选择语句,它被分配给一个变量。有什么帮助吗?
【问题讨论】:
标签: sql oracle select plsql procedure