开发者

Oracle procedure insert from different sources

I can get what am I doing wrong here

create or replace procedure load_category(
p_linea_cod varchar2,
p_modal_cod varchar2,
p_periodo_cod varchar2
)IS

BEGIN
开发者_如何学Go  insert into category(categoryid,externalcategoryid,name)values(
  SEQ_CATEGORY.nextval,
  (select  cod_modal_est,nombre
     from modalidad_estud@ULINK
     where cod_linea_negocio = p_linea_cod
     and cod_modal_est = p_modal_cod)
  );

END;

I'm trying to make a simple insert with a sequence and a select statement(working statement), but can get it work, just receiving this error:

ORA-00947: not enough values

I thank your help in advance.


Your select returns only one column, while you're inserting three. If you need to leave them empty, add NULL values to the select, or leave the columns out of the insert field list.

[edit]

Modified query:

insert into category(categoryid, externalcategoryid, name)
select 
  SEQ_CATEGORY.nextval, cod_modal_est, nombre
from 
  modalidad_estud@ULINK
where 
  cod_linea_negocio = p_linea_cod
  and cod_modal_est = p_modal_cod;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜