问几个问题,rownum、rowid怎么表示呀

shenlele088 2014-01-16 06:49:40
请问下面这些oracle里的操作怎么在pgsql执行。
oracle 中
1、行号rownum
2、地址rowid

3、下面的plsql块为啥不行呢

declare 
n integer:=0;--它老在这里说错误
begin
for n in 1 .. 1000 loop
insert into test values ( nextval('ql_job_seq'));
end loop;
end;

4、这个错误编码上哪里去找呢

哪位大侠帮帮忙
...全文
65 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shenlele088 2014-01-17
  • 打赏
  • 举报
回复
引用 1 楼 yueliangdao0608 的回复:

 create function test() returns void as
$$
declare n integer :=0;
begin
  while n <= 1000 loop
    insert into test values ( nextval('ql_job_seq'));
    n := n + 1; 
  end loop;
end;
$$ language plpgsql
必须写成存储过程吗? 还有伪行号rownum 和记录地址rowid,怎么表示呢?我这么写select oid from test;报错呀
懒得去死 2014-01-17
  • 打赏
  • 举报
回复

 create function test() returns void as
$$
declare n integer :=0;
begin
  while n <= 1000 loop
    insert into test values ( nextval('ql_job_seq'));
    n := n + 1; 
  end loop;
end;
$$ language plpgsql
shenlele088 2014-01-17
  • 打赏
  • 举报
回复
引用 3 楼 yueliangdao0608 的回复:
[quote=引用 2 楼 shenlele088 的回复:] [quote=引用 1 楼 yueliangdao0608 的回复:]

 create function test() returns void as
$$
declare n integer :=0;
begin
  while n <= 1000 loop
    insert into test values ( nextval('ql_job_seq'));
    n := n + 1; 
  end loop;
end;
$$ language plpgsql
必须写成存储过程吗? 还有伪行号rownum 和记录地址rowid,怎么表示呢?我这么写select oid from test;报错呀[/quote] oid 你得在创建表时标明才有。 比如:create table test(...) with oids;
select *,row_number() over() as rownum from test;
[/quote] 老大威武
懒得去死 2014-01-17
  • 打赏
  • 举报
回复
引用 2 楼 shenlele088 的回复:
[quote=引用 1 楼 yueliangdao0608 的回复:]

 create function test() returns void as
$$
declare n integer :=0;
begin
  while n <= 1000 loop
    insert into test values ( nextval('ql_job_seq'));
    n := n + 1; 
  end loop;
end;
$$ language plpgsql
必须写成存储过程吗? 还有伪行号rownum 和记录地址rowid,怎么表示呢?我这么写select oid from test;报错呀[/quote] oid 你得在创建表时标明才有。 比如:create table test(...) with oids;
select *,row_number() over() as rownum from test;

952

社区成员

发帖
与我相关
我的任务
社区描述
PostgreSQL相关内容讨论
sql数据库数据库架构 技术论坛(原bbs)
社区管理员
  • PostgreSQL社区
  • yang_z_1
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧