代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
PLSQL
】
返回值为一个结果集
作者:
Dezai.CN
/ 发布于
2011/9/14
/
968
<div> <font color="#800080">create or replace procedure tjh_getprocessnumber(p_tlplantid VARCHAR2, p_glplantid VARCHAR2, p_inmanchinid VARCHAR2, p_inplanyear VARCHAR2, p_inplanmonth VARCHAR2, P_CURSOR OUT TYPES.CURSORTYPE) is</font> <font color="#800080">VPRODUCENUMBER tzz_contractdata.PRODUCENUMBER%TYPE; --1生产号 VPLANTLOTID tjh_plantproductionplan.PLANLOTID%TYPE; --2计划批次 VSTEELNUMBER tzz_contractdata.STEELNUMBER%TYPE; --3钢号 VSTANDARD tzz_contractdata.STANDARD%TYPE; --4标准 VSHAPE tzz_contractdata.SHAPE%TYPE; --5形状 VWEIGHT tzz_contractdata.ORDERAMOUNT%TYPE; --6重量 VSTEELNAME DT_CIMS.XS_GHZD.GH%TYPE; --7钢号名称 VSTANDARDNAME DT_CIMS.XS_BZZD.BZ%TYPE; --8标准名称 VXZ DT_CIMS.XS_XZZD.XZ%TYPE; --9形状名称 VSECTIONLENGTH tzz_contractdata.SECTIONLENGTH%TYPE; --10长 VSECTIONWIDTH tzz_contractdata.SECTIONWIDTH%TYPE; --11宽 VSECTIONHIGH tzz_contractdata.SECTIONHIGH%TYPE; --12长 VSPCS VARCHAR2(20); --13规格 vduestatus tzz_contractdata.duestatus%TYPE; --14交货状态 vcontractrequire tzz_contractdata.contractrequire%TYPE; --15合同要求 cproducenumber tzz_contractdata.PRODUCENUMBER%TYPE; --16游标中得到的生产号信息 countnumber number; --17统计函数中存在的个数 VFSTANDARD tzz_contractdata.additionalstandard%TYPE; --副标准 VLENGTH tzz_contractdata.length%TYPE; --长度 getnextplant varchar2(20); ---得到函数查询出的信息 NUMTABLE NUMBER; --记录表名的数量(查看是否有叫新建的临时表的表) NUMPERAMOUNT NUMBER; --PERAMOUT记录的数量 STRLIST VARCHAR2(4000);</font> <font color="#800080">cursor CURSTOCK is select distinct b.producenumber from tzz_contractdata a, tjh_plantproductionplan b where a.producenumber = b.producenumber and substr(a.machineid, 0, 2) = p_tlplantid and a.pcyf = to_number(p_inplanmonth) and b.produceyear = p_inplanyear and b.producemonth = p_inplanmonth and b.plantid = p_tlplantid and a.contractstatus not like '已%' and b.ifhavebill = '0'; strType CURSTOCK%rowtype;</font> <font color="#800080">cursor CURSTODT is select distinct b.producenumber from tzz_contractdata a, tjh_plantproductionplan b where a.producenumber = b.producenumber and substr(a.machineid, 0, 2) = p_tlplantid and a.pcyf = to_number(p_inplanmonth) and b.produceyear = p_inplanyear and b.plantid = p_tlplantid and a.contractstatus not like '已%' and b.ifhavebill = '0' and b.processname in (select tc.id from TGY_STANDARDPROCESS tc where substr(tc.equipmenttype, 0, 2) = p_tlplantid and tc.ifkeyprocess = 1 and tc.equipmenttype = p_inmanchinid); strTypeTwo CURSTODT%rowtype;</font> <font color="#800080">begin --建立一个临时表TJH_GETPLANTID, SELECT COUNT(*) INTO NUMTABLE FROM USER_TABLES WHERE TABLE_NAME = 'TJH_GETPLANTID'; IF NUMTABLE < 1 THEN STRLIST := 'CREATE GLOBAL TEMPORARY TABLE TJH_GETPLANTID ' || '(PRODUCENUMBER VARCHAR2(20),' || 'PLANTLOTID NUMBER(10),' || 'STEELNUMBER VARCHAR2(20),' || 'STANDARD VARCHAR2(20),' || 'FTANDARD VARCHAR2(20),' || 'SHAPE VARCHAR2(20),' || 'SPCS VARCHAR2(20),' || 'orderamount NUMBER(10,4),' || /* 'STEELNAME VARCHAR2(50),' ||*/ /* 'STANDARDNAME VARCHAR2(50),' ||*/ /* 'XZ VARCHAR2(6),' ||*/ 'SECTIONLENGTH NUMBER(10,4),' || 'SECTIONWIDTH NUMBER(10,4),' || 'SECTIONHIGH NUMBER(10,4),' || 'LENGTH VARCHAR2(20),' || 'duestatus VARCHAR2(20),' || 'CONTRACTREQUIRE VARCHAR2(10))' || ' ON COMMIT DELETE ROWS '; EXECUTE IMMEDIATE STRLIST; END IF;</font> <font color="#800080">if (p_inmanchinid = '' or p_inmanchinid = null) then open CURSTOCK; fetch CURSTOCK into strType; cproducenumber := strType.producenumber; while CURSTOCK%found loop select count(*) into countnumber from (select F_GETNEXTPLANT(cproducenumber, p_tlplantid, p_glplantid) from dual) get; if (countnumber = 0) then exit; else select F_GETNEXTPLANT(cproducenumber, p_tlplantid, p_glplantid) into getnextplant from dual; if (getnextplant = '00') then exit; else select distinct h.producenumber, p.planlotid, h.steelnumber, h.standard, h.additionalstandard as fstandard, h.shape, f_specs(h.shape, h.sectionlength, h.sectionwidth, h.sectionhigh) as specs, h.orderamount, h.sectionlength, h.sectionwidth, h.sectionhigh, h.length, h.duestatus, h.contractrequire into VPRODUCENUMBER, VPLANTLOTID, VSTEELNUMBER, VSTANDARD, VFSTANDARD, VSHAPE, VSPCS, VWEIGHT, VSECTIONLENGTH, VSECTIONWIDTH, VSECTIONHIGH, VLENGTH, vduestatus, vcontractrequire from tzz_contractdata h, tjh_plantproductionplan p where h.producenumber = p.producenumber and h.producenumber = cproducenumber and h.contractstatus not like '已%'; STRLIST := 'INSERT INTO TJH_GETPLANTID (' || 'PRODUCENUMBER,' || 'PLANTLOTID,' || 'STEELNUMBER,' || 'STANDARD,' || 'FSTANDARD,' || 'SHAPE,' || 'SPCS,' || 'orderamount,' || 'SECTIONLENGTH,' || 'SECTIONWIDTH,' || 'SECTIONHIGH,' || 'LENGTH,' || 'duestatus,' || 'contractrequire) ' || 'VALUES (''' || VPRODUCENUMBER || ''',''' || VPLANTLOTID || ''',''' || VSTEELNUMBER || ''',''' || VSTANDARD || ''',''' || VFSTANDARD || ''',''' || VSHAPE || ''',''' || VSPCS || ''',''' || VWEIGHT || ''',''' || VSECTIONLENGTH || ''',''' || VSECTIONWIDTH || ''',''' || VSECTIONHIGH || ''',''' || VLENGTH || ''',''' || vduestatus || ''',''' || vcontractrequire || ''')'; EXECUTE IMMEDIATE STRLIST; end if; end if; fetch CURSTOCK into strType; end loop; CLOSE CURSTOCK; else open CURSTODT; fetch CURSTODT into strTypeTwo; cproducenumber := strTypeTwo.producenumber; while CURSTODT%found loop select count(*) into countnumber from (select F_GETNEXTPLANT(cproducenumber, p_tlplantid, p_glplantid) from dual) get; if (countnumber = 0) then exit; else select F_GETNEXTPLANT(cproducenumber, p_tlplantid, p_glplantid) into getnextplant from dual; if (getnextplant = '00') then exit; else select distinct h.producenumber, p.planlotid, h.steelnumber, h.standard, h.additionalstandard as fstandard, h.shape, f_specs(h.shape, h.sectionlength, h.sectionwidth, h.sectionhigh) as specs, h.orderamount, h.sectionlength, h.sectionwidth, h.sectionhigh, h.length, h.duestatus, h.contractrequire into VPRODUCENUMBER, VPLANTLOTID, VSTEELNUMBER, VSTANDARD, VFSTANDARD, VSHAPE, VSPCS, VWEIGHT, VSECTIONLENGTH, VSECTIONWIDTH, VSECTIONHIGH, VLENGTH, vduestatus, vcontractrequire from tzz_contractdata h, tjh_plantproductionplan p where h.producenumber = p.producenumber and h.producenumber = cproducenumber and h.contractstatus not like '已%'; STRLIST := 'INSERT INTO TJH_GETPLANTID (' || 'PRODUCENUMBER,' || 'PLANTLOTID,' || 'STEELNUMBER,' || 'STANDARD,' || 'FSTANDARD,' || 'SHAPE,' || 'SPCS,' || 'orderamount,' || 'SECTIONLENGTH,' || 'SECTIONWIDTH,' || 'SECTIONHIGH,' || 'LENGTH,' || 'duestatus,' || 'contractrequire) ' || 'VALUES (''' || VPRODUCENUMBER || ''',''' || VPLANTLOTID || ''',''' || VSTEELNUMBER || ''',''' || VSTANDARD || ''',''' || VFSTANDARD || ''',''' || VSHAPE || ''',''' || VSPCS || ''',''' || VWEIGHT || ''',''' || VSECTIONLENGTH || ''',''' || VSECTIONWIDTH || ''',''' || VSECTIONHIGH || ''',''' || VLENGTH || ''',''' || vduestatus || ''',''' || vcontractrequire || ''')'; EXECUTE IMMEDIATE STRLIST; end if; end if;<img class="editorToolbarButtonOver" src="http://st.blog.163.com/style/common/htmlEditor/place.gif" __1315973864442__="ev_8251493592" alt="" /> fetch CURSTODT into strTypeTwo; end loop; close CURSTODT; end if;</font> <font color="#800080">OPEN P_CURSOR FOR select producenumber, planlotid, steelnumber, standard, fstandard, shape, specs, orderamount, sectionlength, sectionwidth, sectionhigh, length, duestatus, contractrequire from TJH_GETPLANTID;</font> <font color="#800080">end tjh_getprocessnumber;</font> </div>
试试其它关键字
结果集
同语言下
.
查看某张表的表结构
.
oracle 集合操作
.
for 循环中倒序 用reverse
.
Oracle 临时表空间收缩
.
查看session及其对应运行的sql
.
Oracle常用查看表结构命令
.
Oracle Connect By Prior用法(实现递归查询)
.
重置排序 SEQUENCE
.
创建一个trigger
.
批量替换字段中的字符
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3