02 2020 档案

摘要:过程: call procedures_name(p1,p2,...);-- 调用存储过程 select * from user_procedures;-- 获取有关存储过程信息 Show errors for procedure procedure_name;-- 查看存储过程中的错误 函数: s 阅读全文
posted @ 2020-02-19 14:43 admin_jh 阅读(133) 评论(0) 推荐(0)
摘要:set serveroutput on;--打开服务器输出 --declare 声明变量;“:=”是赋值符号 declare v_width integer; v_height integer :=2; v_area integer := 6; v_name store.products.name% 阅读全文
posted @ 2020-02-18 20:36 admin_jh 阅读(154) 评论(0) 推荐(0)
摘要:create flashback archive test_archive tablespace exmple cuota 10 M retention 1 day;--创建闪回归档,最大存储10M数据,保存1天 alter table user.tablename flashback archiv 阅读全文
posted @ 2020-02-18 20:22 admin_jh 阅读(149) 评论(0) 推荐(0)
摘要:select * from user_views;--查询所有视图 阅读全文
posted @ 2020-02-18 20:04 admin_jh 阅读(127) 评论(0) 推荐(0)
摘要:create [unique] index index_name on table_name(column_name[,columnname2...]) tablespace tab_space;--创建索引 select * from all_indexs;--获取所有索引信息 阅读全文
posted @ 2020-02-18 19:59 admin_jh 阅读(94) 评论(0) 推荐(0)
摘要:create sequesce seq_name [start with start_num][increment by increment_num][maxvalue maxnum]--创建序列 select * from all_sequences;--读取所有序列 阅读全文
posted @ 2020-02-18 19:47 admin_jh 阅读(141) 评论(0) 推荐(0)
摘要:user_tables -- 查询当前用户有哪些表 user_table_columns –表字段信息 alter table table_name add column_name varchar2(10);--增加字段 alter table table_name modify column_na 阅读全文
posted @ 2020-02-17 21:37 admin_jh 阅读(112) 评论(0) 推荐(0)
摘要:1、用户 create user user_name identified by pwd ;--创建用户 alter user user_name identified by newpwd;--修改用户密码 上面创建好的用户还不能登录数据库,必须给一个create session系统权限 2、特权 阅读全文
posted @ 2020-02-17 17:03 admin_jh 阅读(1226) 评论(0) 推荐(0)
摘要:管理员用户(sys、system)下的dbms_flashback包 1.给用户(以scott为例)授权操作dbms_flashback包:sqlplus用sys登录,执行命令:grant execute on sys.dbms_flashback to scott; 方式一:按照时间闪回: 用Sc 阅读全文
posted @ 2020-02-17 15:44 admin_jh 阅读(238) 评论(0) 推荐(0)
摘要:--合并两张表的内容 merge into new_table using old_table on (new_table.id = old_table.id) when matched then update newtable .... when not matched then insert n 阅读全文
posted @ 2020-02-16 21:23 admin_jh 阅读(1181) 评论(0) 推荐(0)
摘要:统计不同产品类别在不同月份的销量:pivot 和 unpivot CREATE OR REPLACE VIEW AQKCCKL_NEW_FIN_V AS SELECT T.*, NVL(T.M1,0)+NVL(T.M2,0)+NVL(T.M3,0)+NVL(T.M4,0)+NVL(T.M5,0)+N 阅读全文
posted @ 2020-02-16 20:48 admin_jh 阅读(406) 评论(0) 推荐(0)
摘要:--层次化查询,利用伪列level和lpad函数来判断 select level,lpad(' ',2 * level - 1) || last_name from more_employees --这里可以加where条件查询 start with employee_id = (select em 阅读全文
posted @ 2020-02-16 18:40 admin_jh 阅读(257) 评论(0) 推荐(0)
摘要:--translate(p1,p2,p3):p2中查找p1中的内容匹配到之后转换到p3的位置内容 select translate('I am a student', 'abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba') from d 阅读全文
posted @ 2020-02-16 18:17 admin_jh 阅读(376) 评论(0) 推荐(0)
摘要:create table 销售表 (产品id int,客户id int,销售日期 timestamp(4)); --timestamp(秒精度) insert into 销售表 values(100,1058,timestamp '2020-02-14 17:58:45.1234'); --time 阅读全文
posted @ 2020-02-14 18:23 admin_jh 阅读(1734) 评论(0) 推荐(0)
摘要:alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'; 阅读全文
posted @ 2020-02-14 17:45 admin_jh 阅读(696) 评论(0) 推荐(0)
摘要:--进入用sys进入sqlplus修改 --win + r --> cmd --在cmd命令窗口输入:sqlplus / as sysdba --修改用户密码:alter user Scott identified by p@ssw0rd; 注:可以修改sys密码 阅读全文
posted @ 2020-02-13 18:02 admin_jh 阅读(488) 评论(0) 推荐(0)
摘要:select rowid,rownum,emp.* from emp; 数据库安装之后Scott用户下自带emp表。 阅读全文
posted @ 2020-02-13 17:58 admin_jh 阅读(134) 评论(0) 推荐(0)