日期:2014-05-17  浏览次数:20825 次

SQLite多条sql语句一起执行
insert into Sockets   ( zoneindex, electricequipmentindex, brand, sockettype, vendor, communicationmode) values  (@_zoneindex, @v_electricequipmentindex, @v_brand, @v_sockettype, @v_vendor, @v_communicationmode); insert into reportmeterdatadictionary   ( variabletype, SocketIndex, variablename,  variableunits) values  ( 'real', (select max(SocketIndex) from Sockets),  'Name', 'Unites'); 

在oracle数据库中用分号可以同时执行。到这个不可以。 这个库怎么同时执行多条sql语句了。
不会写存储过程。

第一条先执行。后一条执行的时候拿到第一条执行完最大的ID
------解决方案--------------------
values  ( 'real', (select max(SocketIndex) from Sockets),  'Name', 'Unites'); 
改为:
select 'real', (select max(SocketIndex) from Sockets),  'Name', 'Unites';