oracle数据库编程问题~~~非常急!!
1、以Scott用户身份登录,编写一段代码,提示用户输入要查看哪个表中的记录,如果用户输入“E”,则显示EMP表中EMPO、ENAME、JOB和SAL列的值;如果用户输入...
1、以Scott用户身份登录,编写一段代码,提示用户输入要查看哪个表中的记录,如果用户输入“E”,则显示EMP表中EMPO、ENAME、JOB和SAL列的值;如果用户输入“D”,则显示DEPT表中的DEPTNO、DNAME和LOC列的值。
提示:使用REF游标。
写出的再加分!! 展开
提示:使用REF游标。
写出的再加分!! 展开
4个回答
展开全部
用游标很慢的,内在开销大,且这个流程不是太难。
在代码中,使用switch判断输入的字符,在case中处理分支;
定义一个变量strsql="";每个分支的语句不,如用户输入“E”,strsql="select EMPO,ENAME,JOB,SAL",判断结束后加上表名称和条件,
strsql=" from 表名 where .....",
再运行语句即可。
下面是网上找的,判断单个字符的例子,各语言不同,网上查一下就行了。
#include<stdio.h> int main() { char rank; printf("请输入分数等级:(A、B、C、D、E)\n"); scanf("%c",&rank); switch(rank)//switch((int)score/10)出现严重错误,switch(((int)score)/10)出现严重错误, { case 'A':printf("A(90~100)\n");break; case 'B':printf("B(80~89)\n");break; case 'C':printf("C(70~79)\n");break; case 'D':printf("D(60~69)\n");break; case 'E':printf("E(0~59)\n");break; default:printf("error!\n");break; }
在代码中,使用switch判断输入的字符,在case中处理分支;
定义一个变量strsql="";每个分支的语句不,如用户输入“E”,strsql="select EMPO,ENAME,JOB,SAL",判断结束后加上表名称和条件,
strsql=" from 表名 where .....",
再运行语句即可。
下面是网上找的,判断单个字符的例子,各语言不同,网上查一下就行了。
#include<stdio.h> int main() { char rank; printf("请输入分数等级:(A、B、C、D、E)\n"); scanf("%c",&rank); switch(rank)//switch((int)score/10)出现严重错误,switch(((int)score)/10)出现严重错误, { case 'A':printf("A(90~100)\n");break; case 'B':printf("B(80~89)\n");break; case 'C':printf("C(70~79)\n");break; case 'D':printf("D(60~69)\n");break; case 'E':printf("E(0~59)\n");break; default:printf("error!\n");break; }
参考资料: http://baike.baidu.com/view/600161.htm
展开全部
在plsql developer中要是以scott/tiger登录时提示ora-28000 the account is locked。
解决办法:
新装完Oracle10g后,用scott/tiger测试,会出现以下错误提示:
oracle10g the account is locked
oracle10g the password has expired
原因:默认Oracle10g的scott不能登陆。
解决:
(1)conn sys/sys as sysdba; //以DBA的身份登录
(2)alter user scott account unlock;// 然后解锁
(3)conn scott/tiger //弹出一个修改密码的对话框,修改一下密码就可以了
在运行里面输入cmd在DOS模式下输入sqlplus,以system用户名登录,密码是刚装oracle时自己填写的密码orcl,登录进去以后。
SQL> conn sys/sys as sysdba; (分号是必须的但是我是以system登录的所在这不应该写conn sys/sys as sysdba应该写conn system/orcl as sysdba;)
Connected.
SQL> alter user scott account unlock;
User altered.
SQL> commit;
Commit complete.
SQL> conn scott/tiger//请输入新密码,并确认后OK
Password changed
Connected.
这时再到plsql developer里面以scott/tiger登录就可以了。。。。。
Oracle 10g 默认安装带来的用户名/密码
Username
Password
Description
See Also
CTXSYS
CTXSYS
The Oracle Text account
Oracle Text Reference
DBSNMP
DBSNMP
The account used by the Management Agent component of Oracle Enterprise Manager to monitor and manage the database
Oracle Enterprise Manager Grid Control Installation and Basic Configuration
LBACSYS
LBACSYS
The Oracle Label Security administrator account
Oracle Label Security Administrator's Guide
MDDATA
MDDATA
The schema used by Oracle Spatial for storing Geocoder and router data
Oracle Spatial User's Guide and Reference
MDSYS
MDSYS
The Oracle Spatial and Oracle interMedia Locator administrator account
Oracle Spatial User's Guide and Reference
DMSYS
DMSYS
The Oracle Data Mining account.
Oracle Data Mining Administrator's Guide
Oracle Data Mining Concepts
OLAPSYS
MANAGER
The account used to create OLAP metadata structures. It owns the OLAP Catalog (CWMLite).
Oracle OLAP Application Developer's Guide
ORDPLUGINS
ORDPLUGINS
The Oracle interMedia user. Plug-ins supplied by Oracle and third party format plug-ins are installed in this schema.
Oracle interMedia User's Guide
ORDSYS
ORDSYS
The Oracle interMedia administrator account
Oracle interMedia User's Guide
OUTLN
OUTLN
The account that supports plan stability. Plan stability enables you to maintain the same execution plans for the same SQL statements. OUTLN acts as a role to centrally manage metadata associated with stored outlines.
Oracle Database Performance Tuning Guide
SI_INFORMTN_SCHEMA
SI_INFORMTN_SCHEMA
The account that stores the information views for the SQL/MM Still Image Standard
Oracle interMedia User's Guide
SYS
CHANGE_ON_INSTALL
The account used to perform database administration tasks
Oracle Database Administrator's Guide
SYSMAN
CHANGE_ON_INSTALL
The account used to perform Oracle Enterprise Manager database administration tasks. Note that SYS and SYSTEM can also perform these tasks.
Oracle Enterprise Manager Grid Control Installation and Basic Configuration
SYSTEM
MANAGER
Another account used to perform database administration tasks
解决办法:
新装完Oracle10g后,用scott/tiger测试,会出现以下错误提示:
oracle10g the account is locked
oracle10g the password has expired
原因:默认Oracle10g的scott不能登陆。
解决:
(1)conn sys/sys as sysdba; //以DBA的身份登录
(2)alter user scott account unlock;// 然后解锁
(3)conn scott/tiger //弹出一个修改密码的对话框,修改一下密码就可以了
在运行里面输入cmd在DOS模式下输入sqlplus,以system用户名登录,密码是刚装oracle时自己填写的密码orcl,登录进去以后。
SQL> conn sys/sys as sysdba; (分号是必须的但是我是以system登录的所在这不应该写conn sys/sys as sysdba应该写conn system/orcl as sysdba;)
Connected.
SQL> alter user scott account unlock;
User altered.
SQL> commit;
Commit complete.
SQL> conn scott/tiger//请输入新密码,并确认后OK
Password changed
Connected.
这时再到plsql developer里面以scott/tiger登录就可以了。。。。。
Oracle 10g 默认安装带来的用户名/密码
Username
Password
Description
See Also
CTXSYS
CTXSYS
The Oracle Text account
Oracle Text Reference
DBSNMP
DBSNMP
The account used by the Management Agent component of Oracle Enterprise Manager to monitor and manage the database
Oracle Enterprise Manager Grid Control Installation and Basic Configuration
LBACSYS
LBACSYS
The Oracle Label Security administrator account
Oracle Label Security Administrator's Guide
MDDATA
MDDATA
The schema used by Oracle Spatial for storing Geocoder and router data
Oracle Spatial User's Guide and Reference
MDSYS
MDSYS
The Oracle Spatial and Oracle interMedia Locator administrator account
Oracle Spatial User's Guide and Reference
DMSYS
DMSYS
The Oracle Data Mining account.
Oracle Data Mining Administrator's Guide
Oracle Data Mining Concepts
OLAPSYS
MANAGER
The account used to create OLAP metadata structures. It owns the OLAP Catalog (CWMLite).
Oracle OLAP Application Developer's Guide
ORDPLUGINS
ORDPLUGINS
The Oracle interMedia user. Plug-ins supplied by Oracle and third party format plug-ins are installed in this schema.
Oracle interMedia User's Guide
ORDSYS
ORDSYS
The Oracle interMedia administrator account
Oracle interMedia User's Guide
OUTLN
OUTLN
The account that supports plan stability. Plan stability enables you to maintain the same execution plans for the same SQL statements. OUTLN acts as a role to centrally manage metadata associated with stored outlines.
Oracle Database Performance Tuning Guide
SI_INFORMTN_SCHEMA
SI_INFORMTN_SCHEMA
The account that stores the information views for the SQL/MM Still Image Standard
Oracle interMedia User's Guide
SYS
CHANGE_ON_INSTALL
The account used to perform database administration tasks
Oracle Database Administrator's Guide
SYSMAN
CHANGE_ON_INSTALL
The account used to perform Oracle Enterprise Manager database administration tasks. Note that SYS and SYSTEM can also perform these tasks.
Oracle Enterprise Manager Grid Control Installation and Basic Configuration
SYSTEM
MANAGER
Another account used to perform database administration tasks
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
路过,学习。关注当中
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询