tnblog
首页
视频
资源
登录

Oracle学习过程

4244人阅读 2019/12/30 18:53 总访问:185558 评论:0 收藏:0 手机
分类: Oracle
  1. ```csharp
  2. Oracle  基础知识了解
  3. Oracle   最早员工主管 Kinq
  4. 默认账户
  5. Sys     123456  as  sysdba 
  6. System   123456    dba(数据库管理员)
  7. Scott   tiger(养猫的名字)
  8. (Oracle 公司的第一个员工)
  9. Oracle  公司的三个认证
  10. Oca:oracle  初级认证
  11. Ocp:Oracle企业级认证,终极认证
  12. Ocm : oracle  大师级认证(Oracle 总部)
  13. Oracle 授权命令
  14. grant  权限/角色 to   用户名
  15. Oracle 撤销命令
  16. revoke  权限 from   用户名
  17. 授予权限Create  session 和角色DBA 给数据库管理员
  18. grant  create  session   ,dba to  teacher;
  19. teacher -- 是数据库管理员
  20. Oracle 常用命令
  21. 查询当前登录的用户
  22. Show user
  23. 登录命令/切换账户的命令
  24. Conn  用户名/密码
  25. 锁定账户命令
  26. alter   user 用户名  account lock
  27. 解锁账户命令
  28. alert  user  用户名  account  unlock
  29. 修改密码
  30. alert  user  用户名  identified  密码
  31. 回退事务
  32. Rollback;
  33. 授权命令
  34. Grant 权限 to  用户名
  35. scott 查询权限
  36. 给Scott查询test 表的权限
  37. grant select on  test to scott
  38. 给Scott添加test 表的权限
  39. grant insert  on  test to scott
  40. 给Scott删除test 表的权限
  41. grant delete  on  test to scott 
  42. 取消Scott查询test 表的权限
  43. revoke  select on  test to scott
  44. 总结:查询用grant ,取消用revoke。
  45. Oracle权限传递
  46. 权限传递前提:
  47. 1.自己具有该权限。
  48. 2.权限配置的权限
  49.  
  50.   with   admin  option(系统权限)
  51.   
  52.   with   grant  option(对象权限)
  53. 权限的回收
  54. 如果对象权限会取消,如果是系统权限不会连带取消
  55. 查询角色拥有的各种权限
  56. -- 查询所有的角色
  57. select *  from  dba.roles;
  58. -- 查询某个角色的系统权限
  59. select  *  from  dba_sys_privs  where  grantee='DBA';
  60. 查询某个角色的对象权限
  61. select  *  from  dba_tab_privs  where    grantee='DBA';
  62. 查询某个角色的角色权限
  63. select  *  from  dba_role_privs  where    grantee='DBA';
  64. select  *  from  dba_role_pr
  65. 给Scott查询test 表的权限
  66. grant select on  test to scott
  67. grant select on  test to scott
  68. 开启控制器输出
  69. set  serveroutput  on;
  70. 序列的应用
  71. 创建序列
  72. create  sequence  seq
  73.  start  with  2  --从2开始
  74.  increment by 2 -- 自增 2
  75. 查询序列
  76. select  seq.nextval  from  dual;
  77. 修改序列的最大值
  78. alter  sequence  seq
  79.  maxvalue   50 -- 最大值为50
  80. 让序列循环起来
  81. alter  sequence  seq
  82.  maxvalue   50 -- 最大值为50
  83.  cycle  -- 循环
  84. 让序列无限增长 
  85. alter  sequence  seq 
  86.  increment by 4 -- 自增 2
  87.  nomaxvalue     -- 最大值为50
  88.  nocycle  -- 循环
  89. Oracle 的if判断
  90. declare   i  int:=1;
  91.  
  92.    begin
  93.       
  94.   if i=1 then
  95.      
  96.      dbms_output.put_line('小明') ;
  97.      end  if;
  98.    end;
  99. Oracle的 loop循环
  100. declare   i  int:=1;
  101.  
  102.    begin
  103.       
  104.     loop    
  105.      
  106.      dbms_output.put_line(i) ;
  107.          i:=i+1;
  108.       exit  when i>=20;
  109.      end  loop;
  110.    end;
  111. Oracle的 while循环
  112. declare   i  int:=1;
  113.  
  114.    begin
  115.       
  116.     while  i<20   
  117.      loop
  118.      dbms_output.put_line(i) ;
  119.          i:=i+1;
  120.       
  121.      end  loop;
  122.    end;
  123. Oracle的 for循环
  124. declare   i  int:=1;
  125.  
  126.    begin
  127.       
  128.   for i in  1..20  
  129.      loop
  130.      dbms_output.put_line(i) ;
  131.        
  132.      end  loop;
  133.    end;
  134. Oracle 的 switch 判断
  135. declare   i  int:=1;
  136.  
  137.    begin
  138.       
  139.  case  i 
  140.    when  10  then
  141.      dbms_output.put_line(10) ;
  142.     when  20  then
  143.      dbms_output.put_line(20) ;
  144.       when  30  then
  145.      dbms_output.put_line(30) ; 
  146.      else
  147.         dbms_output.put_line('数字不存在') ;
  148.      end  case;
  149.        
  150.    end;
  151. 建立一个不带参数的时间存储过程
  152. create  or  replace  procedure  time_out
  153. is  
  154. begin 
  155.   dbms_output.put_line(systimestamp);
  156.   end;
  157. 建立一个带有输出参数的存储过程
  158.  create  or  replace  procedure  add_employee 
  159. (EMPNO  NUMBER(4),ENAME    VARCHAR2(10)  ,JOB      VARCHAR2(9),MGR      NUMBER(4),
  160.  ,HIREDATE DATE  , SAL   NUMBER(7,2) ,COMM     NUMBER(7,2),DEPTNO   NUMBER(2))
  161. is 
  162. begin 
  163.   insert  into scott.emp  values (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO )
  164.   end ;
  165. 如何创建带out参数的存储过程
  166.  create   or  replace  procedure  testOut(values1  number ,values2 out number)
  167.  
  168.  is 
  169.  begin
  170.    
  171.  values2:=values1+50;
  172.  end;
  173. 调用存储过程
  174.  declare
  175.  
  176.  result  number;
  177.  begin
  178.    
  179.    testOut(10,result);
  180.    DBMS_OUTPUT.put_line(result);
  181.    end;
  182. 查看表结构
  183. desc scott.emp;
  184. 实例:
  185. Name     Type         Nullable Default Comments 
  186. -------- ------------ -------- ------- -------- 
  187. EMPNO    NUMBER(4)                              
  188. ENAME    VARCHAR2(10) Y                         
  189. JOB      VARCHAR2(9)  Y                         
  190. MGR      NUMBER(4)    Y                         
  191. HIREDATE DATE         Y                         
  192. SAL      NUMBER(7,2)  Y                         
  193. COMM     NUMBER(7,2)  Y                         
  194. DEPTNO   NUMBER(2)    Y 
  195. 创建函数
  196.  create  or   replace  function   get_user
  197.  
  198.  return   varchar2
  199.  is
  200.  v_user varchar2(100);
  201.  begin 
  202.    select  ename  into  v_user  from  scott.emp where  empno='7369';
  203.    return  v_user;
  204.  end;
  205.   
  206. 使用变量接收函数返回值。
  207.  declare  
  208.      username   varchar2(50);
  209.      
  210.      begin
  211.        username:=get_user;
  212.        dbms_output.put_line(username);
  213.      end;
  214. 调用方法:
  215. 1. SQL 语句中直接调用函数。
  216. SQL> select   get_user  from  dual;
  217. GET_USER
  218. --------------------------------------------------------------------------------
  219. SMITH
  220. SQL> 
  221. 创建索引
  222. create  unique   index  indeEMPNO  on   scott.emp(EMPNO);
  223. 创建位图索引
  224. create  bitmap   index  indeJob  on   scott.emp(job);
  225.  
  226. 修改索引
  227. 1.重建索引。
  228. alter   index indeJob rebuild;
  229. rebuild  -- 重建
  230. 2. 合并索引
  231. alter  index indeJob   coalesce;
  232. coalesce   -- 合并
  233. 删除视图
  234. drop  index  indeJob ;
  235. 创建视图
  236.  create  view   view_employee   as    
  237.  select   *  from scott.emp;
  238. 删除视图
  239. drop  view   view_employee;
  240. 创建私有同义词
  241. create  synonym  myemp for  scott.emp;
  242. 创建公有同义词
  243. create  public  synonym  public_myemp for  scott.emp;
  244.  
  245. 删除同义词
  246.  drop synonym  myemp;
  247. 函数的使用
  248. 1.ABS(n).该函数用于返回数字n的绝对值。
  249. select  'ABS:'||   ABS(-12.3) from  dual;
  250. 结果:
  251. 'ABS:'||ABS(-12.3)
  252. ------------------
  253. ABS:12.3
  254. 2.CEIL(n)。返回大于数字n的最小整数。
  255. select  'CEIL:'||   CEIL(-12.3) from  dual;
  256. select  'CEIL:'||   CEIL(12.3) from  dual;
  257. select  'CEIL:'||   CEIL(12) from  dual;
  258. 返回结果:
  259. 'CEIL:'||CEIL(-12.3)
  260. --------------------
  261. CEIL:-12
  262. 'CEIL:'||CEIL(12.3)
  263. -------------------
  264. CEIL:13
  265. 'CEIL:'||CEIL(12)
  266. -----------------
  267. CEIL:12
  268. 3.FLOOR(n) .返回小于等于数字n 的最大整数。
  269. select  'FLOOR:'||   FLOOR(-12.3) from  dual;
  270. select  'FLOOR:'||   FLOOR(12.3) from  dual;
  271. select  'FLOOR:'||   FLOOR(12) from  dual;
  272. 返回结果:
  273. 'FLOOR:'||FLOOR(-12.3)
  274. ----------------------
  275. FLOOR:-13
  276. 'FLOOR:'||FLOOR(12.3)
  277. ---------------------
  278. FLOOR:12
  279. 'FLOOR:'||FLOOR(12)
  280. -------------------
  281. FLOOR:12
  282. 4.ROUND(n,[m]).四舍五入。如果省略吗,则四舍五入至整数,如果m是负数,则四舍五入到小数点前m位;如果m是正数,则四舍五入至小数点m位。
  283. select  'ROUND:'||   ROUND(-12.32344,2) from  dual;
  284. 返回结果:
  285. 'ROUND:'||ROUND(-12.32344,2)
  286. ----------------------------
  287. ROUND:-12.32
  288. 5.TRUNC(n,[m]).截取数字。如果省略吗,则截取至整数,如果m是负数,则截取到小数点前m位;如果m是正数,则截取至小数点m位。
  289. select  'TRUNC:'||   TRUNC(-12.32344,2) from  dual;
  290. 结果:
  291. 'TRUNC:'||TRUNC(-12.32344,2)
  292. ----------------------------
  293. TRUNC:-12.32
  294. 字符函数
  295. LOWER(char) 。将字符串转化为小写格式。
  296. UPPER(char)。 将字符串转化为大写格式。
  297. LENGTH(char)。返回字符串的长度。
  298. LTRIM(char[,set])。去掉字符串char左端包含的set中的任何字符。set默认为空格。
  299. 使用LTRIM()函数。
  300. select  'LTRIM:'||   LTRIM('this  is') from  dual;
  301. select  'LTRIM:'||   LTRIM('this  is','th') from  dual;
  302. 结果:
  303. 'LTRIM:'||LTRIM('THISIS')
  304. -------------------------
  305. LTRIM:this  is
  306. 'LTRIM:'||LTRIM('THISIS','TH')
  307. ------------------------------
  308. LTRIM:is  is
  309. 使用RTRIM()函数。
  310. select  'RTRIM:'||   RTRIM('this  is') from  dual;
  311. select  'RTRIM:'||   RTRIM('this  is','th') from  dual;
  312. 结果:
  313. 'RTRIM:'||RTRIM('THISIS')
  314. -------------------------
  315. RTRIM:this  is
  316. 'RTRIM:'||RTRIM('THISIS','TH')
  317. ------------------------------
  318. RTRIM:this  is
  319. 使用REPLACE()函数。
  320. select  'REPLACE:'||   REPLACE('this  a  apple','this','that') from  dual;
  321. 返回结果:
  322. 'REPLACE:'||REPLACE('THISAAPPL
  323. ------------------------------
  324. REPLACE:that  a  apple
  325. 转化函数
  326. 1.使用TO_NUMBER()函数。
  327. select  'TO_NUMBER:'||   TO_NUMBER('100.33','99999D99') from  dual;
  328. 返回结果:
  329. 'TO_NUMBER:'||TO_NUMBER('100.3
  330. --------------------------------------------------
  331. TO_NUMBER:100.33
  332. 2.使用TO_CHAR()函数。
  333. select  'TO_CHAR:'||   TO_CHAR(sysdate,'yyyy-MM-dd') from  dual;
  334. 返回结果:
  335. 'TO_CHAR:'||TO_CHAR(SYSDATE,'Y
  336. ------------------------------
  337. TO_CHAR:2019-12-27
  338. 3.使用TO_DATE()函数
  339. select  'TO_DATE:'||   TO_DATE('05-03-10','mm-dd-yy') from  dual;
  340. 返回结果:
  341. 'TO_DATE:'||TO_DATE('05-03-10'
  342. ------------------------------
  343. TO_DATE:03-5月 -10
  344. 4.使用NVL()函数。NVL(expr1,expr2),如果expr1是NULL,则返回expr2;否则返回expr1。两者的数据类型必须要匹配。
  345. select  'NVL:'||   NVL(comm,0) from  scott.emp  where  empno=7369;
  346. 返回结果:
  347. 'NVI:'||NVL(COMM,0)
  348. --------------------------------------------
  349. NVI:0
  350. 4.使用NVL2()函数。NVL2(expr1,expr2,expr3),如果expr1是NULL,则返回expr3;否则返回expr2。两者的数据类型可以不匹配。
  351. select  'NVL2:'||   NVL2(comm,0,1) from  scott.emp  where  empno=7369;
  352. 返回结果:
  353. 'NVL2:'||NVL2(COMM,0,1)
  354. ---------------------------------------------
  355. NVL2:1
  356. 5.使用replace 函数
  357. select  'replace'||   replace('kb0932o9312il93111','o','0') from  dual
  358. select  replace((select    replace('kb0932o9312il93111','o','0') from  dual),'i','1')  from  dual
  359. 返回结果:
  360. 'REPLACE'||REPLACE('KB0932O931
  361. ------------------------------
  362. replacekb093209312il93111
  363. REPLACE((SELECTREPLACE('KB0932
  364. ------------------------------
  365. kb0932093121l93111
  366. 多表查询
  367. SQL的集合操作符。
  368. UNION :返回查询检索的所有不重复的行。
  369. UNION ALL :返回查询检索的所有行,包括重复行。
  370. INTERSECT:返回两个查询都检索到的行
  371. MINUS: 返回第一个检索到的行减去第二个查询检索的行所剩余的行
  372. 连接查询
  373. 使用内连接
  374. select  *  from scott.dept,scott.emp  where dept.deptno=emp.deptno;
  375. select  *  from scott.dept  a  inner join scott.emp b  on a.deptno=b.deptno  and  a.deptno=20;
  376. 使用自连接
  377. select manager.ename  from  scott.emp  manager,scott.emp  worker where  manager.empno=worker.mgr  and  worker.ename='smith';
  378. 使用左外连接。
  379. select  *  from scott.dept  a  left join scott.emp b  on a.deptno=b.deptno  and  a.deptno=20;
  380. 使用右外连接。
  381. select  *  from scott.dept  a  right  join scott.emp b  on a.deptno=b.deptno  and  a.deptno=20;
  382. 说明一个完整的PL/SQL块
  383. declare  
  384.    v_ename  varchar2(20);
  385.   begin
  386.     
  387.   select  ename  into  v_ename  from  scott.emp  where  empno=&empno;
  388.   DBMS_OUTPUT.put_line('员工姓名:'  || v_ename);
  389.   exception
  390.     when  no_data_found   then
  391.       dbms_output.put_line('请输入正确的员工号!');
  392.       end;
  393. 输出结果:
  394. 员工姓名:SMITH
  395. PL/SQL procedure successfully completed
  396. 计算员工的工资所得税
  397.  declare  
  398.  
  399.  v_ename   varchar2(20);
  400.  v_sal   number(6,2);
  401.  c_tax_rate  constant  number(3,2):=0.03;
  402.  v_tax_sal   number(6,2);
  403.  
  404.  begin
  405.    
  406.  select  ename,sal  into  v_ename,v_sal  from 
  407.  scott.emp   where  empno=&empno;
  408.  
  409.  v_tax_sal :=v_sal  *  c_tax_rate;
  410. dbms_output.put_line('员工姓名:'||v_ename);
  411. dbms_output.put_line('员工工资:'||v_sal);
  412. dbms_output.put_line('所得税:'||v_tax_sal);
  413. end;
  414. 输出结果:
  415. SQL> /
  416. 员工姓名:SMITH
  417. 员工工资:800
  418. 所得税:24
  419. PL/SQL procedure successfully completed
  420. 使用%type属性计算员工的工资所得税
  421.  declare  
  422.  
  423.  v_ename  scott.emp.ename%type;
  424.  v_sal   number(6,2);
  425.  c_tax_rate  constant  number(3,2):=0.03;
  426.  v_tax_sal   number(6,2);
  427.  
  428.  begin
  429.    select ename,sal into v_ename,v_sal from scott.emp where empno = &empno; 
  430.  v_tax_sal :=v_sal  *  c_tax_rate;
  431. dbms_output.put_line('员工姓名:'||v_ename);
  432. dbms_output.put_line('员工工资:'||v_sal);
  433. dbms_output.put_line('所得税:'||v_tax_sal);
  434. end;
  435. 输出结果:
  436. 员工姓名:SMITH
  437. 员工工资:800
  438. 所得税:24
  439. PL/SQL procedure successfully completed
  440. 条件分支语句
  441. declare   
  442.    v_dep    number(6,2);
  443.    v_sal   number(6,2);
  444. begin
  445.   
  446. select  deptno ,sal  into  v_dep,v_sal  from  scott.emp  where  ename=trim('JAMES');
  447. if  v_dep=10  then
  448.   
  449.   update  scott.emp  set sal=v_sal+200  where deptno=10;
  450.   
  451. elsif  v_dep=20   then
  452.    update  scott.emp  set sal=v_sal+100  where deptno=20;
  453. elsif  v_dep=30   then
  454.    update  scott.emp  set sal=v_sal+50  where deptno=30;
  455.  else  
  456.    update  scott.emp  set sal=v_sal+20  where deptno!=10  and  deptno!=20;
  457.    end  if;
  458. end;
  459. 游标
  460. 1.显示游标
  461. declare 
  462.  cursor   cursor_name
  463. is 
  464. select   123   from  dual;
  465.  begin
  466.    
  467.  open  cursor_name;
  468.  dbms_output.put_line('你好,很热!');
  469.  close cursor_name;
  470.   end;
  471. 输出结果:
  472. SQL> ed
  473. SQL> /
  474. 你好,很热!
  475. PL/SQL procedure successfully completed
  476. 2.使用游标提取部门20名员工的姓名与工资
  477.  declare   
  478.  cursor  emp_cursor
  479.  is
  480.  
  481.    select  ename,sal  from  scott.emp  where deptno=20;
  482.    v_ename  scott.emp.ename%type;
  483.    v_sal  scott.emp.sal%type;
  484.    
  485.   begin
  486.      open  emp_cursor;
  487.      
  488.      loop
  489.       fetch  emp_cursor  into  v_ename ,v_sal;
  490.       exit  when  emp_cursor%Notfound;
  491.       dbms_output.put_line(v_ename||':'||v_sal);
  492.       end  loop;
  493.       close  emp_cursor;
  494.       end;
  495. 运行结果如下:
  496. SQL> set  serveroutput  on;
  497. SQL> /
  498. FORD3:3000
  499. SMITH:800
  500. JONES:2975
  501. SCOTT:3000
  502. ADAMS:1100
  503. FORD:3000
  504. PL/SQL procedure successfully completed
  505. 参数游标
  506.  declare 
  507.  
  508.  cursor  emp_cursor(cno  number)
  509.  is
  510.  
  511.  select  ename ,sal  from  scott.emp  where  deptno=cno;
  512.  v_ename   scott.emp.ename%type;
  513.  v_sal  scott.emp.sal%type;
  514.  begin 
  515.    if  not  emp_cursor  %isopen  then
  516.      
  517.    open  emp_cursor(10);
  518.    end  if;
  519.    
  520.     loop 
  521.     fetch  emp_cursor  into  v_ename,v_sal;
  522.     exit  when   emp_cursor%notfound;
  523.     dbms_output.put_line(v_ename||':'||v_sal);
  524.     end  loop;
  525.     close  emp_cursor;
  526.     end;
  527. 输出结果:
  528. CLARK:2450
  529. KING:5000
  530. MILLER:1300
  531. PL/SQL procedure successfully completed
  532. 使用游标删除或更新数据
  533. 将工资低于2500的员工增加150元工资
  534. declare  
  535.   cursor  emp_cursor
  536. is
  537.   select  ename,sal  from  scott.emp  for  update  of  sal;
  538. v_ename  scott.emp.ename%type;
  539. v_oldsal  scott.emp.sal%type;
  540. begin  
  541.   
  542. open  emp_cursor;
  543.    loop
  544.      fetch emp_cursor  into  v_ename,v_oldsal;
  545.      exit   when  emp_cursor%notfound;
  546.      if   v_oldsal<2500 then
  547.        update  scott.emp  set  sal=sal+150  where current  of  emp_cursor;
  548.        end  if;
  549.        
  550.       end  loop;
  551.       close  emp_cursor;
  552.       end;
  553. 使用游标for循环显示部门编号为20的所有员工姓名
  554.  declare  
  555.  
  556.    cursor  emp_cursor
  557.    is
  558.    select  ename  from  scott.emp  where  deptno=20;
  559.    begin
  560.      
  561.    for   emp_record  in  emp_cursor loop
  562.      
  563.    dbms_output.put_line(''||emp_cursor%rowcount||'个员工'||emp_record.ename);
  564.    end  loop;
  565.    end;
  566. 运行结果:
  567. 第1个员工FORD3
  568. 第2个员工SMITH
  569. 第3个员工JONES
  570. 第4个员工SCOTT
  571. 第5个员工ADAMS
  572. 第6个员工FORD
  573. PL/SQL procedure successfully completed
  574. 在游标for循环中使用子循环显示部门编号20的所有员工姓名
  575. begin
  576.     for  emp_record in
  577.       (select  ename  from  scott.emp  where deptno=20)
  578.       
  579.       loop
  580.         dbms_output.put_line(emp_record.ename);
  581.         end  loop;
  582.      end;
  583. 输出结果:
  584. SQL> ed
  585. SQL> /
  586. FORD3
  587. SMITH
  588. JONES
  589. SCOTT
  590. ADAMS
  591. FORD
  592. PL/SQL procedure successfully completed
  593. 建立before语句触发器,保证员工信息的修改只能在工作时间。
  594.  
  595.  create  or  replace   trigger   tr_sec_emp
  596.  before  insert or  update  or  delete  on  scott.emp
  597.  declare
  598.  begin
  599.    if  to_char(susdate,'dy','bls_date_language=AMERICAN') IN ('sat','sum')
  600.      then 
  601.        raise_application_error(-20001,'今天是休息时间,不能改变员工信息');
  602.      end  if;
  603.    end  tr_sec_emp;
  604. 使用dbms_output 包输出99乘法表
  605. begin
  606.   dbms_output.put_line('打印久久乘法表');
  607.  for  i  in 1..9  loop
  608.    for  j  in 1..i  loop
  609.      dbms_ouput.put_line(i||'*'j||'='||i*j);
  610.      dbms_ouput.put_line('  ');
  611.    end  loop;
  612.    dbms_output.new_line;
  613.  end loop;
  614.  end;
  615. 输出结果:
  616. SQL> set  serverout  on;
  617. SQL> /
  618. 打印久久乘法表
  619. 1*1=1  
  620. 2*1=2  2*2=4  
  621. 3*1=3  3*2=6  3*3=9  
  622. 4*1=4  4*2=8  4*3=12  4*4=16  
  623. 5*1=5  5*2=10  5*3=15  5*4=20  5*5=25  
  624. 6*1=6  6*2=12  6*3=18  6*4=24  6*5=30  6*6=36  
  625. 7*1=7  7*2=14  7*3=21  7*4=28  7*5=35  7*6=42  7*7=49  
  626. 8*1=8  8*2=16  8*3=24  8*4=32  8*5=40  8*6=48  8*7=56  8*8=64  
  627. 9*1=9  9*2=18  9*3=27  9*4=36  9*5=45  9*6=54  9*7=63  9*8=72  9*9=81  
  628. PL/SQL procedure successfully completed
  629. ```


评价

Oracle数据库中没有scott用户

使用SYS用户登录conn sys/密码 as sysdba(默认密码123456)然后找到oracle安装目录下scott.sql的这个文件然后执行命令:@+...

Oracle自定义函数的简单使用

一.最最最简单的返回一个数字的函数createorreplacefunctionfun_show returnint--申明返回值 as begin return1; end;...

Oracle存储过程

一个简单的带输入输出参数的存储过程(求两数之和)createorreplaceprocedureproc_sum(p1int,p2int,presultoutint) as be...

Oracle事务的简单使用

事务:  事务是一个整体,这些操作要么全部执行成功,要么全部不执行。使用事务的原因:保证数据的安全有效。事务的四个特...

Oracle编程基础

简单介绍一下oracle中if,else,case when,循环,异常处理等用法if,elsedeclareptypeint:=2; begin ifptype=1then dbms_out...

Oracle使用游标

其实游标就是把查询的结果放入游标中,然后在去游标里边读取。相当于使用游标做了一个中转,而游标是可以作为参数进行传递...

Oracle程序包

当项目越来越大的时候,数据库中的函数,存储过程等越来越多。为了方便管理,Oracle建议使用程序包的管理机制。实现业务模...

Oracle中MERGE INTO,for,start with,decode用法

1. MERGEINTO:MERGEINTOT_TD_BU_MODIFY_NOTICE_LSA USING( selectMODIFY_NOTICE_ID,REJECT_REASONfromT_TD_BU_MODIFY_NOT...

Oracle+命令

oracle常用命令SQLPLUS进入oracle撤销命令revoke 权限 form 用户名show user查询当前登录账户锁定账户命令Alter user 用户...

Oracle 11g数据库的安装+空间管理

如果你在圣诞节没有收到礼物,请不要伤心也不要难过,因为接下来还有元旦,春节,还有情人节,还有元宵节......慢慢的你就...

Oracle--常用命令、条件语句、循环语句、SQL函数

Oracle常用命令1、登录数据库默认账户 默认密码 拥有权限sys 123456 as sysdba 拥有数据库的最高权限system ...

Oracle数据库的基本操作

Oracle数据库Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域...

Oracle数据库的认识和基本使用

推荐一个Oracle数据库的一个学习网站:http://www.oraclejsq.com/article/010100110.html一、对Oracle数据库的认识1、数据...

Oracle操作

Oracle数据库操作1、创建数据库create database databasename2、删除数据库drop database dbname3、备份数据库完全备份exp ...

Oracle 安装和常用的命令

Oracle 安装如下:https://jingyan.baidu.com/article/f79b7cb32095f79144023eae.html默认账户Sys 123456 as sysdba 数据...

Oracle数据库的同义词与视图

同义词概念:同义词顾名思义,是数据库方案对象的一个别名。这里的数据库方案对象指表、视图、序列、存储过程、包等。创建...
人若没梦想,那跟咸鱼有啥样
排名
20
文章
32
粉丝
7
评论
21
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术
我愿将歌化作风,聆听朗朗的春声。