Oracle function input value, query data, return corresponding processing result

Source: Internet
Author: User

Create or Replace function Fun_search_orderby (InstaceidinchVarchar2,tye in varchar2)returnvarchar2 isnum number; A number; B number; F Number;kv_ys varchar2 ( -); Kv_zg varchar2 ( -); Kv_tj varchar2 ( -); Cv_ys varchar2 ( -); Cv_zg varchar2 ( -); Cv_tj varchar2 ( -); Gv_ys varchar2 ( -); Gv_zg varchar2 ( -); Gv_tj varchar2 ( -); Begin num:=0; ifTye='0' Then--description for the mine has been rectified for 3 has been submitted as 2 has been accepted as 1 Kv_ys:='80f3fdc9-25d5-48d9-aeb6-51f860ebc65e'; SelectCOUNT (*) into A fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=kv_ys;--Acceptance KV_ZG:='1e9b5b88-a2b1-456c-a52f-197decb74c9c'; SelectCOUNT (*) into B fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=kv_zg;--Rectification KV_TJ:='a2342268-2f72-49be-9073-625220bed3b4'; SelectCOUNT (*) into F fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=kv_tj;--SubmitifA=1Then num:=1; elsif B=1Then num:=3; elsif F=1Then num:=2; Endif; Endif; ifTye='1' Then--description for factory Cv_ys:='b31a3d30-301e-4bf2-98bc-c223b172dfb0'; SelectCOUNT (*) into A fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=cv_ys;--Acceptance CV_ZG:='90d7c167-f9a9-4b4b-beed-ee1e43f9ec8e'; SelectCOUNT (*) into B fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=cv_zg;--Rectification CV_TJ:='bed2a800-adfc-4269-831f-cfee05bc6336'; SelectCOUNT (*) into F fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=cv_tj;--SubmitifA=1Then num:=1; elsif B=1Then num:=3; elsif F=1Then num:=2; Endif; Endif; ifTye='2' Then--description for factory Gv_ys:='53b83eeb-ec91-4b59-bf2b-a5a80d6089f6'; SelectCOUNT (*) into A fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=gv_ys;--Acceptance GV_ZG:='7e9cb10c-2119-475b-823b-9ce8e2d6490f'; SelectCOUNT (*) into B fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=gv_zg;--Rectification GV_TJ:='5e9880f8-e427-4fd3-9ee3-872095bb9e8b'; SelectCOUNT (*) into F fromWorkflowTaskwhereStatus =2and InstanceID = Instaceid and stepid=gv_tj;--SubmitifA=1Then num:=1; elsif B=1Then num:=3; elsif F=1Then num:=2; Endif; Endif;returnNum;end;

Oracle function input value, query data, return corresponding processing result

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.