create or replace trigger community_trigger after insert or update or delete
on community for each row
begin if inserting then
Insert into users(username,passwd,permit,org) values((select DISTINCT init from county where county_name=:NEW.county)||:NEW.code||'02',(select DISTINCT init from county where county_name=:NEW.county) || :NEW.code || '02' || '888' ,65, :NEW.hos_name);
elsif updating then
Update users set Update users set
username=(select DISTINCT init from county where county_name=:NEW.county) || :NEW.code || '02',
passwd=(select DISTINCT init from county where county_name=:NEW.county) || :NEW.code || '02' || '888',
org=:NEW.hos_name
Where username=(select DISTINCT init from county where county_name=:OLD.county) || :OLD.code || '02'; elsif deleting thenDelete from users where username=(select DISTINCT init from county where county_name=:OLD.county) || :OLD.code ||'00';
end if;end;
问题主要是出在update进行字符串拼接的时候,老是提示SQL命令未正确结束,由于新学的sql,所以不是很懂,麻烦懂的告诉下,谢谢。
解决方案 »
- Oracle11gr2还能用浏览器登录Sql吗?
- 我是新手,向各位大侠请教一个问题:怎样在oracle 定义一个游标?
- Oracle转义符的使用
- ora-00604和ora-04031问题。
- ★★有个关于group by分组的SQL向高手请教
- 关于多表查询的研究
- 一个简单的trigger问题
- 如何获得trigger的脚本?如何获得表的脚本,如何获得包的脚本?
- clob入参
- 打开oracle数据库报ora-01092;ora00704;ora00600错误
- 请教个oracle sql 写法?
- 这个等待是什么啊Streams AQ: waiting for time management or cleanup tasks
在update语句中,使用保存拼接好的字符串变量来给字段更新值。