当前位置: 首页 > news >正文

Oracle之PL/SQL存储过程与函数练习题(七)

        • 1.创建一个存储过程,以员工号为参数,输出该员工的工资
        • 2.创建一个存储过程,以员工号为参数,修改该员工的工资。若该员工属于10号部门,则工资增加150;若属于20号部门,则工资增加200;若属于30号部门,则工资增加250;若属于其他部门,则增加300。
        • 3.创建一个存储过程,以员工号为参数,返回该员工的工作年限(以参数形式返回)。
        • 4.创建一个存储过程,以部门号为参数,输出入职日期最早的10个员工信息。
        • 5.创建一个函数,以员工号为参数,返回该员工的工资。
        • 6.创建一个函数,以部门号为参数,返回该部门的平均工资。
        • 7.创建一个函数,以员工号为参数,返回该员工所在的部门的平均工资。
        • 8.创建一个存储过程,以员工号和部门号作为参数,修改员工所在的部门为所输入的部门号。如果修改成功,则显示“员工由……号部门调入调入……号部门”;如果不存在该员工,则显示 “员工号不存在,请输入正确的员工号。”;如果不存在该部门,则显示 “该部门不存在,请输入正确的部门号。”。
        • 9.创建一个存储过程,以一个整数为参数,输入工资最高的前几个(参数值)员工的信息。
        • 10.创建一个存储过程,以两个整数为参数,输出工资排序在两个参数之间的员工信息。
        • 11.创建一个过程,能向dept表中添加一个新记录。(in参数)
        • 12.从emp表中查询给定职工(提示:使用&来输入员工编号)的职工姓名和工资。(要求:利用out模式的参数将值传给调用者。)
        • 13.创建一个过程,在执行调用过程时,可随机输入emp表中某个雇员的姓名,根据雇员的姓名,返回该雇员的薪水值,并输出。(out参数)。
        • 14.编写过程,实现交换两个变量的值的功能。并输出交换前和交换后的两个值。(in out参数)
        • 15.创建存储过程,根据员工编号删除emp表中的相关记录。(提示:由调用语句提供的员工编号来删除记录,要求员工编号可输入。)
        • 16. 创建存储过程:输入部门编号,输出emp表中该部门所有职工的员工编号、姓名、工作岗位。
        • 17.编写一个过程,指定一个员工编号与一个工资增加的百分比,使emp表中将该员工的工资(sal)增加输入的百分比。
        • 18.创建函数,从emp表中查询指定员工编号的职工的工资
        • 19.创建函数,返回emp表中指定职工的工资和姓名。
        • 20. 创建函数,根据给定的部门编号(提示: 利用&),计算该部门所有职工的平均工资。
        • 21.创建函数,将emp表中工资低于平均工资的职工工资加上200,并返回修改了工资的总人数.
        • 22.创建一个函数,仅有一个形参,它接收调用函数中传递过来的实参部门号,函数的返回值为该部门的一整条记录信息
        • 23.
    • c1 c2
        • 24.查找出当前用户模式下,每张表的记录数,以scott用户为例,结果应如下:
        • 25.存储过程和函数,完成下面的功能:输入姓名,课程名,成绩,该过程完成对SC表的插入或修改操作,若插入成功,返回成功信息,若该选课信息已经存在,则修改其成绩为输入的成绩,若遇系统错误,返回错误信息。
        • 26.建立过程,当传入姓名和年龄,保存在stu表中.首先判断stu表表是否存在,若不存在则创建该表格(包括姓名和年龄两列)

1.创建一个存储过程,以员工号为参数,输出该员工的工资

法一:

create or replace procedure fa(v_empno number,v_sal out number)
is
beginselect sal into v_sal from emp where empno=v_empno;
end;
----------------------------------------------------------------
declarev_empno number(5):=7369;v_sal number(5);
beginfa(v_empno,v_sal);dbms_output.put_line(v_empno||','||v_sal);
end;

法二:

create or replace procedure fa(eno emp.empno%type)
isv_sal emp.sal%type;--声明变量,存储员工编号对应的工资
beginselect sal into v_sal from emp where empno=eno;dbms_output.put_line('该员工的工资为:'||v_sal);
end;
----------------------------------------------------------------
call fa(7369);

2.创建一个存储过程,以员工号为参数,修改该员工的工资。若该员工属于10号部门,则工资增加150;若属于20号部门,则工资增加200;若属于30号部门,则工资增加250;若属于其他部门,则增加300。

法一:

create or replace procedure fb(v_empno number)
isv_deptno number;v_sal number;
beginbeginselect deptno into v_deptno from emp where empno=v_empno;exceptionwhen no_data_found thendbms_output.put_line('该员工不存在');return;end;case v_deptnowhen 10 then v_sal:=150;when 20 then v_sal:=200;when 30 then v_sal:=250;else v_sal:=300;end case;update empset sal=sal+v_salwhere deptno=v_deptno;
end;
----------------------------------------------------------------
call fb(7369);

法二:

create or replace procedure fb(eno emp.empno%type)
isv_dno emp.deptno%type;--声明变量存储该员工对应的部门编号
beginbeginselect deptno into v_dno from emp where empno=eno;exceptionwhen NO_DATA_FOUND thendbms_output.put_line('该员工不存在');return;--退出end;case v_dnowhen 10 thenupdate emp set sal=sal+150 where empno=eno;when 20 thenupdate emp set sal=sal+200 where empno=eno;when 30 thenupdate emp set sal=sal+250 where empno=eno;elseupdate emp set sal=sal+300 where empno=eno;end case;
end;
----------------------------------------------------------------
call fb(7369);

3.创建一个存储过程,以员工号为参数,返回该员工的工作年限(以参数形式返回)。

法一:

create or replace procedure f3(v_empno number,v_hd out date)
is
beginselect hiredate into v_hd from emp where empno=v_empno;
end;
----------------------------------------------------------------
declarev_hd date;
beginf3(7369,v_hd);dbms_output.put_line(floor(months_between(sysdate,v_hd)/12));
end;

法二:

create or replace procedure f3(eno emp.empno%type,v_year out number)
is
beginselect (sysdate-hiredate)/365 into v_year from emp where empno=eno;
end;
----------------------------------------------------------------
declarev_y number;--声明变量,用来接收存储过程返回输出的工作年限
beginf3(7369,v_y);--调用存储过程,v_y存储的是工作年限dbms_output.put_line('工作年限:'||floor(v_y));
end;

4.创建一个存储过程,以部门号为参数,输出入职日期最早的10个员工信息。

法一:

create or replace procedure f4(v_deptno number)
is
beginfor v in (select e.*,rownum from(select * from emp where deptno=v_deptno order by hiredate)e where rownum<=2) loopdbms_output.put_line(v.ename||','||v.job||','||v.sal||','||v.hiredate);end loop;
end;
----------------------------------------------------------------
call f4(20);

法二:

create or replace procedure f4(dno emp.deptno%type)
iscursor cur_e is select e.*,rownum from (select * from emp where deptno=dno order by hiredate) e where rownum<=10;
begin for e in cur_e loopdbms_output.put_line(e.ename||','||e.sal||','||e.hiredate);end loop;
end;
----------------------------------------------------------------
call f4(30);

5.创建一个函数,以员工号为参数,返回该员工的工资。

create or replace function f1(v_empno number)
return number
isv_sal number(10);
beginselect sal into v_sal from emp where empno=v_empno;return v_sal;
end;
----------------------------------------------------------------
begindbms_output.put_line(f1(7369));
end;
或:
select f1(7369) from dual;

6.创建一个函数,以部门号为参数,返回该部门的平均工资。

create or replace function f6(v_deptno number)
return number
isv_avgsal number(10);
beginselect avg(sal) into v_avgsal from emp where deptno=v_deptno;return v_avgsal;
end;
----------------------------------------------------------------
begindbms_output.put_line(f6(30));
end;

7.创建一个函数,以员工号为参数,返回该员工所在的部门的平均工资。

create or replace function f7(v_empno number)
return number
isv_deptno emp.deptno%type;v_avgsal number(10);
beginselect deptno into v_deptno from emp where empno=v_empno;select avg(sal) into v_avgsal from emp where deptno=v_deptno;return v_avgsal;
end;
----------------------------------------------------------------
begindbms_output.put_line(f7(7369));
end;

8.创建一个存储过程,以员工号和部门号作为参数,修改员工所在的部门为所输入的部门号。如果修改成功,则显示“员工由……号部门调入调入……号部门”;如果不存在该员工,则显示 “员工号不存在,请输入正确的员工号。”;如果不存在该部门,则显示 “该部门不存在,请输入正确的部门号。”。

法一:

create or replace procedure fc(v_empno number,v_deptno number)
isv_esum number(10);v_d varchar2(10);v_dsum number(5);
beginselect count(*) into v_esum from emp where empno=v_empno;select count(*) into v_dsum from emp where deptno=v_deptno;if v_esum=0 thendbms_output.put_line('员工号不存在,请输入正确的员工号。');end if;if v_dsum=0 thendbms_output.put_line('该部门不存在,请输入正确的部门号。');end if;if v_esum=1 and v_dsum>=1 thendbms_output.put_line('员工由'||v_d||'号部门调入'||v_deptno||'号部门. ');select deptno into v_d from emp where empno=v_empno;update emp set deptno=v_deptno where empno=v_empno;end if;
end;
----------------------------------------------------------------
call fc(1254534,30);

法二:

create or replace procedure fc(eno emp.empno%type,dno emp.deptno%type)
isdno_1 emp.deptno%type;--修改前dno_2 emp.deptno%type;--修改后
beginbegin--员工号是不是存在--根据员工编号查询出该员工对应的部门select deptno into dno_1 from emp where empno=eno;exceptionwhen no_data_found thendbms_output.put_line('该员工不存在');return;--退出end;begin--部门号是不是存在select deptno into  dno_2  from dept where deptno=dno;exceptionwhen no_data_found thendbms_output.put_line('该部门不存在');return;--退出end;    update emp set deptno=dno where empno=eno;dbms_output.put_line('员工由'||dno_1||'号部门调入调入'||dno||'号部门');
end;
----------------------------------------------------------------
call fc(7369,12);

9.创建一个存储过程,以一个整数为参数,输入工资最高的前几个(参数值)员工的信息。

法一:

create or replace procedure fd(n number)
iscursor v_emp is select * from emp order by sal desc;v_n number:=0;
beginfor i in v_emp loopdbms_output.put_line(i.ename||','||i.sal);v_n:=v_n+1;exit when v_n=n;end loop;
end;
----------------------------------------------------------------
call fd(5);

法二:

create or replace procedure fd(i number)
iscursor c_e is select e.*,rownum from (select * from emp order by sal desc) e where rownum<=i;
beginfor e in c_e loopdbms_output.put_line(e.ename||','||e.sal);end loop;
end;
----------------------------------------------------------------
call fd(3);

10.创建一个存储过程,以两个整数为参数,输出工资排序在两个参数之间的员工信息。

法一:

create or replace procedure fe(m number,n number)
iscursor v_emp is select * from emp where sal between m and n;
beginfor i in v_emp loopdbms_output.put_line(i.ename||','||i.sal);end loop;
end;
----------------------------------------------------------------
call fe(2000,4000);

法二:

create or replace procedure fe(i1 number,i2 number)
isbeginfor e in (select * from emp where sal between i1 and i2) loopdbms_output.put_line(e.ename||','||e.sal);end loop;
end;
----------------------------------------------------------------
call p_t10(3000,5000);

11.创建一个过程,能向dept表中添加一个新记录。(in参数)

create or replace procedure ff(v_id number,v_name varchar2,v_loc varchar2)
is
begininsert into deptvalues(v_id,v_name,v_loc);
end;
----------------------------------------------------------------
call ff(50,'rongyao','huawei');

12.从emp表中查询给定职工(提示:使用&来输入员工编号)的职工姓名和工资。(要求:利用out模式的参数将值传给调用者。)

create or replace procedure fg(v_e in out emp%rowtype)
is
beginselect * into v_e from emp where empno=v_e.empno;
end;
----------------------------------------------------------------
declarev_e emp%rowtype;
beginv_e.empno:=&员工编号;fg(v_e);dbms_output.put_line(v_e.ename||', '||v_e.sal);
end;

13.创建一个过程,在执行调用过程时,可随机输入emp表中某个雇员的姓名,根据雇员的姓名,返回该雇员的薪水值,并输出。(out参数)。

create or replace procedure fh(v_name varchar2,v_sal out number)
is
beginselect sal into v_sal from emp where ename=v_name;
end;
----------------------------------------------------------------
declarev_ename emp.ename%type:='&雇员名';v_sal emp.sal%type;
beginfh(v_ename,v_sal);dbms_output.put_line(v_ename||','||v_sal);
end;

14.编写过程,实现交换两个变量的值的功能。并输出交换前和交换后的两个值。(in out参数)

create or replace procedure fi(m in out number,n in out number)
isv number(5);
beginv:=m;m:=n;n:=v;
end;
----------------------------------------------------------------
declarem number:=4;n number:=5;
begindbms_output.put_line(m||', '||n);fi(m,n);dbms_output.put_line(m||', '||n);
end;

15.创建存储过程,根据员工编号删除emp表中的相关记录。(提示:由调用语句提供的员工编号来删除记录,要求员工编号可输入。)

create or replace procedure fj(v_id number)
is
begindelete from emp where empno=v_id;
end;
----------------------------------------------------------------
call fj(7369);

16. 创建存储过程:输入部门编号,输出emp表中该部门所有职工的员工编号、姓名、工作岗位。

create or replace procedure fk(v_id number)
iscursor v_emp is select empno,ename,job from emp where deptno=v_id;
beginfor i in v_emp loopdbms_output.put_line(i.empno||','||i.ename||','||i.job);end loop;
end;
----------------------------------------------------------------
call fk(30);

17.编写一个过程,指定一个员工编号与一个工资增加的百分比,使emp表中将该员工的工资(sal)增加输入的百分比。

create or replace procedure fl(v_id number,v_salp number)
is
beginupdate empset sal=sal*(1+v_salp/100)where empno=v_id;
end;
----------------------------------------------------------------
call fl(7369,30);

18.创建函数,从emp表中查询指定员工编号的职工的工资

create or replace function fm(v_id number)
return number
isv_sal emp.sal%type;
beginselect sal into v_sal from emp where empno=v_id;return v_sal;
end;
---------------------------------------------------------------- 
begindbms_output.put_line(fm(7369));
end;

19.创建函数,返回emp表中指定职工的工资和姓名。

法一:

create or replace function fm(v_id number)
return number
isv_sal emp.sal%type;v_ename emp.ename%type;
beginselect sal,ename into v_sal,v_ename from emp where empno=v_id;dbms_output.put_line(v_ename);return v_sal;
end;
----------------------------------------------------------------
begindbms_output.put_line(fm(7369));
end;

法二:

create or replace function fn(v_id number,v_name out varchar2)
return number
isv_sal emp.sal%type;
beginselect sal,ename into v_sal,v_name from emp where empno=v_id;return v_sal;
end;
----------------------------------------------------------------
declarev_sal number(5);v_name varchar2(5);
beginv_sal:=fn(7369,v_name);dbms_output.put_line(v_name||','||v_sal);
end;

20. 创建函数,根据给定的部门编号(提示: 利用&),计算该部门所有职工的平均工资。

create or replace function fo(v_id number)
return number
isavg_sal number;
beginselect avg(nvl(sal,0)) into avg_sal from emp where deptno=v_id;return avg_sal;
end;
----------------------------------------------------------------
declarev_id emp.deptno%type:=&部门编号;
begindbms_output.put_line(fo(v_id));
end;

21.创建函数,将emp表中工资低于平均工资的职工工资加上200,并返回修改了工资的总人数.

法一:

create or replace function fp
return number
iscursor v_emp is select ename from emp where sal<(select avg(nvl(sal,0)) from emp);v_sum number:=0;
beginfor i in v_emp loopupdate empset sal=sal+200where ename=i.ename;v_sum:=v_sum+1;end loop;return v_sum;
end;
----------------------------------------------------------------
begindbms_output.put_line(fp);
end;

法二:

create or replace function fp
return number
is
beginupdate emp set sal=sal+200 where sal<(select avg(sal) from emp);return sql%rowcount;
end;
----------------------------------------------------------------
begindbms_output.put_line(fp());
end;

22.创建一个函数,仅有一个形参,它接收调用函数中传递过来的实参部门号,函数的返回值为该部门的一整条记录信息

create or replace function fq(v_id number)
return dept%rowtype
is v_dept dept%rowtype;
beginselect * into v_dept from dept where deptno=v_id;return v_dept;
end;
----------------------------------------------------------------
declarei dept%rowtype;
begini:=fq(30);dbms_output.put_line(i.deptno||', '||i.dname||', '||i.loc);
end;

23.

c1 c2

1 西
1 安
1 的
2 天
2 气
3 好
……
转换为
1 西安的
2 天气
3 好
要求:不能改变表结构及数据内容,仅在最后通过SELECT显示出这个查询结果

create table cc(c1 number(5),c2 varchar2(5)
);
insert into cc values(1,'西');
insert into cc values(1,'安');
insert into cc values(1,'的');
insert into cc values(2,'天');
insert into cc values(2,'气');
insert into cc values(3,'好');
create or replace function fcc(n number)
return varchar2
iss varchar2(50);
beginfor i in (select * from cc where c1=n) loops:=s||i.c2;end loop;return s;
end;
----------------------------------------------------------------
select c1,fcc(c1) from cc group by c1;

24.查找出当前用户模式下,每张表的记录数,以scott用户为例,结果应如下:

DEPT…4
EMP…14
BONUS…0
SALGRADE…5
提示:查找用户下所有表名的sql为select table_name from user_tables;
法一:

create or replace procedure fs
isv_tablename varchar2(100);v_sql varchar2(100);v_sum number(10);cursor v_name is select table_name from user_tables;
beginopen v_name;fetch v_name into v_tablename;while v_name%found loopexecute immediate 'select count(*) from '||v_tablename into v_sum;dbms_output.put_line(v_tablename||'-----------'||v_sum);fetch v_name into v_tablename;end loop;close v_name;
end;
----------------------------------------------------------------
call fs();

法二:

create or replace procedure fs
isc number; v_sql varchar2(100);
beginfor tn in (select table_name from user_tables) loopv_sql:='select count(*) from '||tn.table_name;dbms_output.put_line(v_sql);execute immediate v_sql into c;dbms_output.put_line(tn.table_name||'----------'||c);end loop;
end;
----------------------------------------------------------------
call fs();

25.存储过程和函数,完成下面的功能:输入姓名,课程名,成绩,该过程完成对SC表的插入或修改操作,若插入成功,返回成功信息,若该选课信息已经存在,则修改其成绩为输入的成绩,若遇系统错误,返回错误信息。

create or replace procedure f_25(v_name varchar2,c_name varchar2,v_score number)
isv_sno varchar2(10);v_cno varchar2(10);n number(5);
beginselect sno into v_sno from student where sname=v_name;select cno into v_cno from course where cname=c_name;select count(*) into n from sc where sno=v_sno and cno=v_cno;if n=1 thenupdate sc set score=v_score where sno=v_sno and cno=v_cno;dbms_output.put_line('修改成功');else insert into sc values(v_sno,v_cno,v_score);dbms_output.put_line('插入成功');end if;exceptionwhen others thendbms_output.put_line(sqlerrm);
end;
----------------------------------------------------------------
call f_25('李四','SSH',60);

26.建立过程,当传入姓名和年龄,保存在stu表中.首先判断stu表表是否存在,若不存在则创建该表格(包括姓名和年龄两列)

create or replace procedure f_26(v_name varchar2,v_age number)
isn number(5);
beginselect count(*) into n from user_tables where table_name='STU';if n=0 thenexecute immediate 'create table stu(sname varchar2(5),age number)';end if;execute immediate 'insert into stu values('''||v_name||''','||v_age||')';
end;
----------------------------------------------------------------
declarev_name varchar2(5):='&姓名';v_age number(5):=&年龄;
beginf_26(v_name,v_age);
end;

相关文章:

Oracle之PL/SQL存储过程与函数练习题(七)

1.创建一个存储过程&#xff0c;以员工号为参数&#xff0c;输出该员工的工资2.创建一个存储过程&#xff0c;以员工号为参数&#xff0c;修改该员工的工资。若该员工属于10号部门&#xff0c;则工资增加150&#xff1b;若属于20号部门&#xff0c;则工资增加200&#xff1b;若…...

C++入门教程||C++ 基本的输入输出||C++ 数据结构

C 基本的输入输出 C 基本的输入输出 C 标准库提供了一组丰富的输入/输出功能&#xff0c;我们将在后续的章节进行介绍。本章将讨论 C 编程中最基本和最常见的 I/O 操作。 C 的 I/O 发生在流中&#xff0c;流是字节序列。如果字节流是从设备&#xff08;如键盘、磁盘驱动器、…...

线性表——顺序表

文章目录一&#xff1a;线性表二&#xff1a;顺序表1&#xff1a;概念与结构1&#xff1a;静态顺序表2&#xff1a;动态顺序表2&#xff1a;动态顺序表的代码实现1&#xff1a;结构2&#xff1a;接口实现1&#xff1a;初始化2&#xff1a;释放内存3&#xff1a;检查容量4&#…...

第六章 Vite4+Vue3+Vtkjs 模型颜色切换、漫反射曲面颜色

一、介绍 💥 💥 Vtk里面工具非常的齐全,但是相关的文档又少之又少,只能花大量时间去阅读源码。漫反射曲面颜色是什么意思呢,Vtk可以使用漫反射曲面颜色来模拟光线在表面反射时的颜色。漫反射是一种光线与表面发生碰撞后,被散射到各个方向的现象,这种现象可以用来解释物…...

【QT学习七】QTreeWidget

目录 一、QTreeWidget 概述 二、QTreeWidget 的基本使用 2.1、创建 QTreeWidget 控件 2.2、设置 QTreeWidget 的大小和位置 2.3、设置 QTreeWidget 的列数和列标题 2.4、添加节点 2.5、读取节点 2.6、设置节点数据 2.7、自定义节点样式 三、注意事项 四、完整示例 一…...

【Linux】组管理和权限管理

目录1 Linux组的基本介绍2 文件/目录所有者2.1 查看文件的所有者2.2 修改文件所有者3 组的创建3.1 基本指令3.2 应用实例4 文件/目录 所在组4.1 查看文件/目录所在组4.2修改文件/目录所在的组5 其他组6 改变用户所在组6.1 改变用户所在的组6.2 应用实例7 权限介绍8 rwx权限详解…...

从零到一发布 NPM 包

如果你负责前端的基础能力建设&#xff0c;发布各种功能/插件包犹如家常便饭&#xff0c;所以熟悉对 npm 包的发布与管理是非常有必要的&#xff0c;故此有了本篇总结文章。本篇文章一方面总结&#xff0c;一方面向社区贡献开箱即用的 npm 开发、编译、发布、调试模板&#xff…...

uniapp国际化配置

1、创建资源文件 创建一个locale文件夹&#xff0c;新增index.js,en.json,zh-hans.json 2.配置locale文件夹中的index.js文件 import Vue from vue import VueI18n from vue-i18n// v8.x import en from ./en.json import zhHans from ./zh-Hans.json import zhHant from .…...

前端中 try-catch 捕获不到哪些异常和常见错误

在开发过程中&#xff0c;我们的目标是 0error&#xff0c;0warning。 但有很多因素并不是我们可控的&#xff0c;为了避免某块代码的错误&#xff0c;影响到其他模块或者整体代码的运行&#xff0c;我们经常会使用try-catch模块来主动捕获一些异常或者错误。 比如我们在获取…...

javaEE 初阶 — 如何构造一个 HTTP 请求

文章目录使用 form 表单标签构造1 构造 GET 请求2 构造 POST 请求使用 ajax 构造1 什么是异步2 代码中如何使用 ajax使用第三方工具构造1 postman 工具的安装2 postman 工具的使用使用 form 表单标签构造 1 构造 GET 请求 使用 form 表单构造 HTTP 请求&#xff0c;需要用到两…...

CentOS 7下安装PostgreSQL 15版本数据库(图文详细)

文章目录CentOS 7下安装PostgreSQL 15版本数据库(图文详细)1 简介1.1 概述1.2 官网2 PostgreSQL安装2.1 选定版本2.2 安装依赖2.3 执行安装2.4 初始化2.5 配置环境变量2.6 创建数据库2.6.1 进入命令行2.6.2 创建DB2.6.3 设置密码2.7 配置远程2.8 测试链接3 pgAdmin4工具安装3.1…...

代码随想录算法训练营第五十一天 | 309. 最佳买卖股票时机含冷冻期、714. 买卖股票的最佳时机含手续费

309. 最佳买卖股票时机含冷冻期 动规五部曲 1、确定dp数组以及下标的含义 dp[i][j]&#xff0c;第i天状态为j&#xff0c;所剩的最多现金为dp[i][j]。 具体可以区分出如下四个状态&#xff1a; 状态一&#xff1a;持有股票状态&#xff08;今天买入股票&#xff0c;或者是…...

中英文拼写检测纠正开源项目使用入门 word-checker 1.1.0

项目简介 word-checker 本项目用于单词拼写检查。支持英文单词拼写检测&#xff0c;和中文拼写检测。 特性说明 可以迅速判断当前单词是否拼写错误 可以返回最佳匹配结果 可以返回纠正匹配列表&#xff0c;支持指定返回列表的大小 错误提示支持 i18n 支持大小写、全角半角…...

面试如果还不会Netty,看这篇文章就够了

我们去面试的时候&#xff0c;经常被问到netty的题目。我整理了netty的32连问。小伙伴们&#xff0c;收藏起来慢慢看吧。 1. Netty是什么&#xff0c;它的主要特点是什么&#xff1f; Netty是一个高性能、异步事件驱动的网络编程框架&#xff0c;它基于NIO技术实现&#xff0…...

作为大学生,你还不会搭建chatGPT微应用吗?

目录 引言ChatGPT是什么&#xff1f;背景&#xff1a;ChatGPT敢为人先&#xff0c;打破全球僵局示例演示&#xff1a;基于ChatGPT微应用实现的条件及步骤&#xff08;1&#xff09;整体框架&#xff08;2&#xff09;搭建前的准备工作&#xff08;3&#xff09;实际搭建步骤&a…...

Three.js教程:第一个3D场景

推荐&#xff1a;将NSDT场景编辑器加入你3D工具链其他工具系列&#xff1a;NSDT简石数字孪生下面的代码完整展示了通过three.js引擎创建的一个三维场景&#xff0c;在场景中绘制并渲染了一个立方体的效果&#xff0c;为了大家更好的宏观了解three.js引擎&#xff0c; 尽量使用了…...

lua快速入门~在js基础上,知道Lua 和 Js 的不同即可

☺ lua 和 javaScript 差不多的&#xff0c;就是一些语法的细节不同&#xff0c;学过js&#xff0c;再注意一下下面的细节&#xff0c;就能上手了~ 快速入门&#xff0c;可以直接看一下菜鸟教程的lua&#xff1a;https://www.runoob.com/lua/lua-tutorial.html Lua 和 Js 的不同…...

Linux系统【Centos7】更换源详细教程

更换CentOS 7系统的源可以提高网络速度&#xff0c;加快软件升级和安装的速度。以下是详细的更换CentOS 7源实践。 步骤 1&#xff1a;备份原始 Yum.repo 在更换之前&#xff0c;首先要备份原始 Yum.repo 文件&#xff08;一定要记得备份&#xff09;。 bash sudo mv /etc/y…...

金三银四求职季来了!分享几道最常见的app面试题,帮助您更好准备面试求职!

目录&#xff1a;导读 引言 一、Web 端测试和 App 端测试有何不同? 二、App是如何测试的&#xff1f; 三、app闪退的可能原因&#xff1f; 四、给你一个登录页面,你要如何测试&#xff1f; 五、测试过程中遇到app出现crash或者ANR&#xff0c;你会怎么处理&#xff1f; …...

Java集合——List接口学习总结

一、ArrayList实现类 1. 常用方法 增加&#xff1a;add(int index, E element)删除&#xff1a;remove(int index) remove(Object o)修改&#xff1a;set(int index, E element)查看&#xff1a;get(int index)判断&#xff1a;常用遍历方式&#xff1a;//List集合 遍历&…...

MPNet:旋转机械轻量化故障诊断模型详解python代码复现

目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...

TDengine 快速体验(Docker 镜像方式)

简介 TDengine 可以通过安装包、Docker 镜像 及云服务快速体验 TDengine 的功能&#xff0c;本节首先介绍如何通过 Docker 快速体验 TDengine&#xff0c;然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker&#xff0c;请使用 安装包的方式快…...

应用升级/灾备测试时使用guarantee 闪回点迅速回退

1.场景 应用要升级,当升级失败时,数据库回退到升级前. 要测试系统,测试完成后,数据库要回退到测试前。 相对于RMAN恢复需要很长时间&#xff0c; 数据库闪回只需要几分钟。 2.技术实现 数据库设置 2个db_recovery参数 创建guarantee闪回点&#xff0c;不需要开启数据库闪回。…...

IGP(Interior Gateway Protocol,内部网关协议)

IGP&#xff08;Interior Gateway Protocol&#xff0c;内部网关协议&#xff09; 是一种用于在一个自治系统&#xff08;AS&#xff09;内部传递路由信息的路由协议&#xff0c;主要用于在一个组织或机构的内部网络中决定数据包的最佳路径。与用于自治系统之间通信的 EGP&…...

ElasticSearch搜索引擎之倒排索引及其底层算法

文章目录 一、搜索引擎1、什么是搜索引擎?2、搜索引擎的分类3、常用的搜索引擎4、搜索引擎的特点二、倒排索引1、简介2、为什么倒排索引不用B+树1.创建时间长,文件大。2.其次,树深,IO次数可怕。3.索引可能会失效。4.精准度差。三. 倒排索引四、算法1、Term Index的算法2、 …...

Spring Boot+Neo4j知识图谱实战:3步搭建智能关系网络!

一、引言 在数据驱动的背景下&#xff0c;知识图谱凭借其高效的信息组织能力&#xff0c;正逐步成为各行业应用的关键技术。本文聚焦 Spring Boot与Neo4j图数据库的技术结合&#xff0c;探讨知识图谱开发的实现细节&#xff0c;帮助读者掌握该技术栈在实际项目中的落地方法。 …...

【服务器压力测试】本地PC电脑作为服务器运行时出现卡顿和资源紧张(Windows/Linux)

要让本地PC电脑作为服务器运行时出现卡顿和资源紧张的情况&#xff0c;可以通过以下几种方式模拟或触发&#xff1a; 1. 增加CPU负载 运行大量计算密集型任务&#xff0c;例如&#xff1a; 使用多线程循环执行复杂计算&#xff08;如数学运算、加密解密等&#xff09;。运行图…...

【C语言练习】080. 使用C语言实现简单的数据库操作

080. 使用C语言实现简单的数据库操作 080. 使用C语言实现简单的数据库操作使用原生APIODBC接口第三方库ORM框架文件模拟1. 安装SQLite2. 示例代码:使用SQLite创建数据库、表和插入数据3. 编译和运行4. 示例运行输出:5. 注意事项6. 总结080. 使用C语言实现简单的数据库操作 在…...

Unit 1 深度强化学习简介

Deep RL Course ——Unit 1 Introduction 从理论和实践层面深入学习深度强化学习。学会使用知名的深度强化学习库&#xff0c;例如 Stable Baselines3、RL Baselines3 Zoo、Sample Factory 和 CleanRL。在独特的环境中训练智能体&#xff0c;比如 SnowballFight、Huggy the Do…...

3403. 从盒子中找出字典序最大的字符串 I

3403. 从盒子中找出字典序最大的字符串 I 题目链接&#xff1a;3403. 从盒子中找出字典序最大的字符串 I 代码如下&#xff1a; class Solution { public:string answerString(string word, int numFriends) {if (numFriends 1) {return word;}string res;for (int i 0;i &…...