oracle sql常见问题集

jiezhi 2002-12-04 04:41:58
加精
-------------
1、DDL, DML和DCL 的不同
-------------
(1)DDL is Data Definition Language statements. Some examples:
CREATE,
ALTER,
DROP,
RUNCATE (emove all records from a table, including all spaces allocated for the records are removed),
COMMENT(dd comments to the data dictionary ),
GRANT,
EVOKE(ithdraw access privileges given with the GRANT command )
(2)DML is Data Manipulation Language statements. Some examples:
SELECT,
INSERT,
UPDATE,
DELETE(deletes all records from a table, the space for the records remain),
CALL(call a PL/SQL or Java subprogram),
EXPLAIN PLAN (explain access path to data ),
LOCK TABLE (control concurrency )

(3)DCL is Data Control Language statements. Some examples:
COMMIT - save work done
SAVEPOINT - identify a point in a transaction to which you can later roll back
ROLLBACK - restore database to original since the last COMMIT
SET TRANSACTION - Change transaction options like what rollback segment to use
...全文
7646 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
hobo_boy 2002-12-09
  • 打赏
  • 举报
回复
刚学ORACLE
顶一下!
jiezhi 2002-12-09
  • 打赏
  • 举报
回复
大家把自己的好东西都拿出来吧!
z5wjz 2002-12-09
  • 打赏
  • 举报
回复
学习
april_jia 2002-12-08
  • 打赏
  • 举报
回复
鼓励!
dongquestion 2002-12-06
  • 打赏
  • 举报
回复
我要苦学oracle了,不行了,以前从来没有用过oracle,连sql plus都不太会用啊
jiezhi 2002-12-06
  • 打赏
  • 举报
回复
很不错。
  • 打赏
  • 举报
回复
问:如何在游标中产生动态的SQL语句
答:
包头:
create or replace package getstu is
type MY_refcur is ref cursor; --定义引用型游标
--定义返回值为引用型游标
function doget(stuname varchar2) return my_REFCUR;
end;
/
包体:
create or replace package body getstu as
function doget(stuname varchar2) return my_REFCUR
is
var_cur my_refcur;
begin
open var_cur for select xh,xm from stu where xm like '%'||stuname||'%';
return var_cur;
end;
end;
----------------------------
现学现卖,今天才弄明白的!:)
ws9300 2002-12-06
  • 打赏
  • 举报
回复
select * from ml_tindex('mytable');
没错吗?
如何用!?
RedFire 2002-12-06
  • 打赏
  • 举报
回复
好象不行的说。Windows 2000 Server;Oracle 8i
jiezhi 2002-12-06
  • 打赏
  • 举报
回复
有环境的兄弟测试一下:
select * from ml_tindex('mytable');
我这里只有db2没有oracle
jackjonse 2002-12-05
  • 打赏
  • 举报
回复
还有呢,能不能贴点常用的,,,,,,譬如,权限回收,显示所有用户什么的!

越多越好.
cn_afei 2002-12-05
  • 打赏
  • 举报
回复
gz
jiezhi 2002-12-05
  • 打赏
  • 举报
回复
oracle一样还有不少不完善的地方。
xbin999 2002-12-05
  • 打赏
  • 举报
回复
select * from ml_tindex('mytable');
是什么用法?
oldwain 2002-12-05
  • 打赏
  • 举报
回复
感觉上, ORACLE把CALL和EXPLAIN PLAN归入DML很勉强.

除了这两个语句与DML一样不会自动提交事务以外, 简直与数据处理(Data Manipulation )不沾边.

jiezhi 2002-12-05
  • 打赏
  • 举报
回复
---------------------------------------------
6、add a day/hour/minute/second to a date value
---------------------------
select sysdate, sysdate+1/24, sysdate +1/1440, sysdate + 1/86400 from dual;


----------------------------
7、对一列的不同值作统计
---------------------------
select jgbh 机构编号, sum( decode(sex,'男',1,0)) 男,
sum(decode(sex,'女',1,0)) 女
from t_yg
group by 机构编号;

---------------------------------------------------
8、对一列的值作范围内的统计
----------------------------
select jgbh,
sum(decode(greatest(age,59), least(age,100), 1, 0)) "年龄60-100",
sum(decode(greatest(age,30), least(age, 59), 1, 0)) "年龄30-59",
sum(decode(greatest(age, 0), least(age, 29), 1, 0)) "年龄0-29"
from pepole
group by jgbh;
glmcglmc 2002-12-05
  • 打赏
  • 举报
回复
gz
zpwly 2002-12-05
  • 打赏
  • 举报
回复
关注
jiezhi 2002-12-04
  • 打赏
  • 举报
回复
--------------
4、得到一个表所有的索引信息
---------------
select * from ml_tindex('mytable');


-----------------------
5、generate primary key values for a table
-----------------------
CREATE SEQUENCE sequence_name START WITH 1 INCREMENT BY 1;
UPDATE table_name SET seqno = sequence_name.NEXTVAL;

****************************************************
大家多多补充呀!
jiezhi 2002-12-04
  • 打赏
  • 举报
回复
我这里看着是好的,怎么回事?
加载更多回复(5)

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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