declare c int := 0; begin select count(1) into c from employee; --ORACLE不支持字段+*的写法,需求逐个写出所有字段。 select c,t.field1,t.field2,...,t.fieldn from employee t; end;
select c,t.field1,t.field2,...,t.fieldn from employee t; 错误:在此select语句中缺少into子句
select @c,* from Employee 原来应该是打印的意思吧,在oracle sql中应该用dbms_output.put_line()来输出变量 SELECT 列名 INTO 变量 FROM 表名 WHERE 条件; 是指从数据库中查询数据为变量赋值,要求查询的结果必须是一行,不能是多行或者没有记录 你应该再定义几个变量,用来存放你查询的列中的数据
sqlserver中这句话代表返回此结果集。打印是print
declare @c int select @c=count(*) from Employee select @c,* from Employeedeclare c number(32,0); rs sys_refcursor; begin select count(*) into c from Employee; open rs for 'select '||c||',e.* from Employee e'; end;
c int := 0;
begin
select count(1) into c from employee;
--ORACLE不支持字段+*的写法,需求逐个写出所有字段。
select c,t.field1,t.field2,...,t.fieldn from employee t;
end;
错误:在此select语句中缺少into子句
原来应该是打印的意思吧,在oracle sql中应该用dbms_output.put_line()来输出变量
SELECT 列名 INTO 变量 FROM 表名 WHERE 条件;
是指从数据库中查询数据为变量赋值,要求查询的结果必须是一行,不能是多行或者没有记录
你应该再定义几个变量,用来存放你查询的列中的数据
sqlserver中这句话代表返回此结果集。打印是print
select @c=count(*) from Employee
select @c,* from Employeedeclare
c number(32,0);
rs sys_refcursor;
begin
select count(*) into c from Employee;
open rs for 'select '||c||',e.* from Employee e';
end;