当前位置:网站首页>execute immediate 简单示例合集(DML)
execute immediate 简单示例合集(DML)
2022-07-28 22:42:00 【赟文武】
带不确定参数的DML
- 增
--编写pl/sql程序块实现将用户输入数据插入dept表
declare
v_deptno dept.deptno%type:=&请输入部门号;
v_dname dept.dname%type:='&请输入部门名';
v_loc dept.loc%type:='&请输入部门地址';
begin
execute immediate 'insert into dept values(:a,:b,:c)' using v_deptno,v_dname,v_loc;
end;

- 删
--编写pl/sql程序块实现将dept表中用户输入的部门号对应得数据删除
declare
c number:=&请输入要删除信息的部门号;
begin
execute immediate 'delete from dept where deptno=:a' using c;
end;

- 改
--编写一个pl/sql代码块实现根据用户输入雇员号将该雇员工资设置为1000
declare
v_empno emp.empno%type:=&请输入雇员号;
begin
execute immediate 'update emp set sal=1000 where empno=:a' using v_empno;
end;

- 查
--编写一个pl/sql代码块实现根据用户输入表名查询该表人数,并打印
Declare
a NUMBER;
v_table varchar2(20):='&请输入一个表名';
v_sql Varchar2(100);
BEGIN
v_sql:='select count(*) from '||v_table;
Execute Immediate v_sql INTO a;
dbms_output.put_line(v_table||'--------'||a);
END;

边栏推荐
- Oracle实例无法启动的问题如何解决
- 面试被问到了String相关的几道题,你能答上来吗?
- 动态规划问题(六)
- [CNN] Why is the convolution kernel size of CNN usually odd
- NPM run serve stuck at 40%
- PTA (daily question) 7-70 diamond
- 动态规划问题(七)
- ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
- Anti shake and throttling
- 【MySQL 8】Generated Invisible Primary Keys(GIPK)
猜你喜欢
![[small bug diary] Navicat failed to connect to MySQL | MySQL service disappeared | mysqld installation failed (this application cannot run on your computer)](/img/ac/f63e370df72ace484a618cf946d4b7.png)
[small bug diary] Navicat failed to connect to MySQL | MySQL service disappeared | mysqld installation failed (this application cannot run on your computer)

MySQL sub database and sub table and its smooth expansion scheme

Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track

vulnhub:SolidState

PTA (daily question) 7-77 encryption

Statistical analysis of time series

Html+css+php+mysql realize registration + login + change password (with complete code)

html+css+php+mysql实现注册+登录+修改密码(附完整代码)

MySql中的like和in走不走索引

Still writing a lot of if to judge? A rule executor kills all if judgments in the project
随机推荐
What does WGet mean
Dynamic programming problem (VII)
[applet project development -- JD mall] uni app commodity classification page (first)
【开发教程10】疯壳·开源蓝牙心率防水运动手环-蓝牙 BLE 收发
动态规划问题(二)
How to solve the problems of MQ message loss, duplication and backlog?
17. Design of machine learning system
Oracle super full SQL, details crazy
动态规划问题(六)
Talk about seven ways to realize asynchronous programming
NPM run serve stuck at 40%
PTA (daily question) 7-75 how many people in a school
MQ 消息丢失、重复、积压问题,如何解决?
Api 接口优化有哪些技巧?
Multimodal model sketch (1)
MySQL事务(transaction) (有这篇就足够了..)
【飞控开发基础教程8】疯壳·开源编队无人机-I2C(激光测距)
Calculate properties and listeners
乱打日志的男孩运气怎么样我不知道,加班肯定很多!
Applet waterfall flow, upload pictures, simple use of maps