您的位置:首页 > 数据库 > Oracle

常用且老记不住的几个ORACLE技巧

2012-01-10 08:35 489 查看
--设置sql到oracle的数据库连接

sp_addlinkedserver 'THSCMP','ORACLE','MSDAORA','THSCMP' ---THSCMP,CMP数据库名

sp_addlinkedsrvlogin 'THSCMP','FALSE',NULL,'HSCMP','HSCMP'

--闪回查询

select * from tabel_aa as of timestamp to_timestamp('2011-01-06 11:30:00', 'yyyy-mm-dd hh24:mi;ss')

--赋予权限

grant create any table to lsbh0826

Oracle创建序列

create sequence seq_a minvalue 1000 maxvalue 99999999 start with 1000 increment by 1 nocache;

查询序列

select seq_a.nextval from dual;

递归查询--这里递归的是组织编码

select orgcode from torgmanage where shorpgrade like pShopgrade start with orgcode=porgcode connect by prior orgcode=preorgcode
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: