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

sqlserver转oracle
DECLARE @count INT
SELECT @count = COUNT(*) FROM tests
SELECT @count AS totalCounts,* FROM tests

这个是sqlserver语法。在oracle中,怎么写?

------解决方案--------------------
/*
DECLARE @count INT
SELECT @count = COUNT(*) FROM tests
SELECT @count AS totalCounts,* FROM tests
*/
declare
cnt int := 0;
begin
select count(1) into cnt from tests;
select cnt as totalcounts,字段列表(请一一写出来 ORACLE不支持单表使用字段+*的用法) from tests;
end;
------解决方案--------------------
探讨

还是有错,我没明白你的意思,你是创建临时表吗?