%rowtype
declare selectedemp emp %rowtype;begin select empid,empname,empadd,empphone,email,mgr,hiredate,comm,deptno into selectedemp from emp where empid=00102;ORA-06550: 第 4 行, 第 42 列:PL/SQL: ORA-00913: 值过多当没有完全为selectedemp赋值时,就会发生不匹配。[@more@]
脚本文件命名
SQL> @ D:sqlOracle实用教程type%.txt;SP2-0310: 无法打开文件 "D:sqlOracle实用教程type%.txt"SQL> @ D:sqlOracle实用教程%type.txt;SP2-0310: 无法打开文件 "D:sqlOracle实用教程%type.txt"SQL> @ D:sqlOracle实用教程type.txt;name:Ivanid:00102PL/SQL 过程已成功完成。[@more@]
select into
declare dianhua varchar2(20);begin select empphone into dianhua from emp where empid like '00801'; dbms_output.put_line('部门地址'||dianhua);end;/开始使用like '008%'显示exact fetch returns more than requested number of rows明白是select into 结果集只能是有一个仅有一行。[@more@]
引号
去网上问了下引号的使用。select empname,'''s name is ' ,empid from emp;第三个字符代表特殊转义字符,表示这个字符后边会跟一个特殊字符,直接把这个特殊字符拼出来即可。比如select '''' from dual;返回的将是一个单引号,你可以看一下[@more@]
别名的使用和null
select empadd as add from emp;出现错误ORA-00923: FROM keyword not found where expectedselect empadd as name from emp;能正确的显示结果。原因探索中。估计是add是关键字。null是一种状态。 select empadd||'wuhan' from emp where empid like '0080%';empadd是varchar2型,empadd=null,显示结果为wuhanselect deptno+50 from emp where empid like '00804';deptno为number型,deptno=null,显示结果为null[@more@]
em可以用了,orcl可以连接到odbc了
前几天em不能使用,今天突然能用了。我想主要原因在于dbconsoleorcl和tnslistener能够启动了。不过有一点还是不太明白em登录时既然只能用sys登录,system没有权限;odbc连接时用的是system,而sys却不行。不过能用了,还是万幸的。我想在在安全策略----->用户权限指派------>批处理中加入了我用的管理员帐户有关的,这招还是管用的。pl/sql developer也能用了。不错[@more@]
ping
ping命令不能用了。网上搜到,修改path为%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;应该可以了~~成功了。今天还发现,还可以ping计算机名,不止是ip[@more@]
大小写问题
遇到一个大小写问题,发贴求助。后来得到答案。我是刚学习oracle没几天的新手,我遇到一个问题。在sql*plus中输入:SQL> create role r01;Role created.SQL> grant create table to r01;Grant succeeded.SQL> grant r01 to zhang;Grant succeeded.SQL> select * from ROLE_SYS_PRIVS where ROLE='r01';no rows selected当输入SQL> select * from ROLE_SYS_PRIVS WHERE ROLE='R01';显示出我想要的结果我想问,当时我建立用户时是小写的r01,为什么查询从role_sys_privs中查询这个用户相关的资料时却要用大写的R01才可以?sel
无法启动dbconsole
不知道为什么突然不能启动dbconsole了,以至于em也无法使用,还有pl/sql developer也不能登录了。 启动dbconsole时侯的问题 C:Documents and Settingszhangyaning>emctl status dbconsoleOracle Enterprise Manager 10g Database Control Release 10.1.0.2.0Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.http://zhangyaning:5500/em/console/aboutApplicationOracle Enterprise Manager 10g is not running.C:Documents and Settingszhangyaning>emctl start dbconsoleOracle Enterprise Manager
em和iql*plus的问题
isql*plus只能用domain登录,不能用计算机名登录。在Db_1目录下没有zhangyaning_orcl文件,只有192.168.1.107_orcl文件。重装后,出现了zhangyaning_orcl文件,domain和计算机名都可以登录了。[@more@]