oracle存储过程(怎么才oracle中查看存储过程)

本文目录
怎么才oracle中查看存储过程
可用语句查看或用第三方工具查看。
一、语句查看方法:
1、执行语句:
SELECT textFROM user_source
WHERE NAME = ’Procedure Name’
ORDER BY line;--其中Procedure Name为存储过程名字,需要全部用大写英文。
2、如要查P_TEST的存储过程:
SELECT textFROM user_source
WHERE NAME = ’P_TEST’
ORDER BY line;
3、内容如下:
二、工具查看:
1、登录第三方工具(如pl/sql)登录到指定数据库。
2、左侧树中找到Procedures,然后找到相应的存储过程。
3、右键该存储过程,选择“查看”。
4、然后就可以看到了。
Oracle存储过程游标for循环怎么写
一、不带参数的游标for循环
1
首先编写存储过程的整体结构,如下:
create or replace procedure test_proc is
v_date date; --变量定义
begin
select sysdate into v_date from dual;
end test_proc;
2
定义游标:
create or replace procedure test_proc is
v_date date; --定义变量
cursor cur is select * from ldcode; --定义游标
begin
select sysdate into v_date from dual;
end test_proc;
3
编写for循环:
create or replace procedure test_proc is
v_date date; --定义变量
cursor cur is select * from ldcode where rownum《10; --定义游标
begin
select sysdate into v_date from dual;
--游标for循环开始
for temp in cur loop --temp为临时变量名,自己任意起
Dbms_Output.put_line(temp.Code); --输出某个字段,使用“变量名.列名“即可。
end loop;
--游标for循环结束
end test_proc;
4
测试运行,点击【DBMS Output】标签页查看结果如下图:
END
二、带参数的游标for循环
1
定义带参数的游标:
cursor cur(v_codetype ldcode.Codetype%TYPE) is
select * from ldcode where codetype = v_codetype; --定义游标
定义游标格式:
cursor 游标名称(变量定义) is 查询语句;
注意:
where条件中的变量名v_codetype要与游标定义cur(v_codetype ldcode.Codetype%TYPE)中的一致。
2
编写for循环部分:
--游标for循环开始
for temp in cur(’llmedfeetype’) loop
--temp为临时变量名,自己任意起
--cur(’llmedfeetype’)为“游标名称(传入的变量)“
Dbms_Output.put_line(temp.Code); --输出某个字段,使用“变量名.列名“即可。
end loop;
--游标for循环结束
3
测试运行,点击【DBMS Output

本文相关文章:
图片免费转换成word(怎样快速把图片文字变成word文档)
2026年10月10日 06:10
stripper(想请教一下whore bitch hooker slut prostitute stripper 的区别谢谢有研究的人来回答)
2026年10月10日 01:20
app store普通下载(为什么苹果的应用程序只能在App Store里下载)
2026年9月23日 19:30
confirm password(confirm password什么意思)
2026年9月16日 20:30
冒险岛079下载(冒险岛更新079maplestory.exe)
2026年9月10日 09:40
讯读转换器word转pdf(怎么把word文档转换成pdf)
2026年8月20日 23:50
更多文章:
another time(another time和other time的区别)
2026年10月11日 05:00




