Oracle multiple statements executed simultaneously (e.g. two datasets returned)

Source: Internet
Author: User

 PublicDataSet getqualitystatistics (DateTime start_date,datetime end_date,stringModality,stringhospital_id) {StringBuilder SQL=NewStringBuilder (); List<DbParameter> paras =NewList<dbparameter>(); Idbhelper DBHelper=Dbfactory.createdbhleper (); DataSet DS=NewDataSet (); Switch(sqltype) { Case "MSSQL2008":                                        Break;  Case "Oracle": SQL. Append ("begin"); //evaluation of image quality in departmentSql. Append (@"open:var_1 for ' SELECT COUNT (*) NUM, NVL (b.dept_image_quality,2) Quality,to_char (a.registration_date, ' mm ') MONTH from Patient_registration A left JOIN quality_evaluation B on a.registration_id=b.reg_id WHERE to_char (a.registr Ation_date, ' Yyyy-mm-dd hh:mi:ss ') >= '"+start_date+""'" )                       . Append (@"and To_char (a.registration_date, "Yyyy-mm-dd hh:mi:ss") <= ""+end_date+""and modality=""+modality+""and hospital_id=""+hospital_id+""'")                       . Append (@"GROUP by B.dept_image_quality,to_char (a.registration_date, "mm") ORDER by B.dept_image_quality,to_char (A.                       Registration_date, ' mm ') '; "); //SQL. Append ("");                    ////In-Department report quality evaluation                    //SQL. Append ("Begin");Sql. Append (@"open:var_2 for ' SELECT COUNT (*) NUM, NVL (b.dept_report_quality,2) Quality,to_char (a.registration_date, ' mm ') MONTH from Patient_registration A left JOIN quality_evaluation B on a.registration_id=b.reg_id WHERE to_char (a.registr Ation_date, ' Yyyy-mm-dd hh:mi:ss ') >= '"+start_date+""'")                       . Append ("and To_char (a.registration_date, "Yyyy-mm-dd hh:mi:ss") <= ""+end_date+""and modality=""+modality+""and hospital_id=""+hospital_id+""'")                     . Append (@"GROUP by B.dept_report_quality,to_char (a.registration_date, "mm") ORDER by B.dept_report_quality,to_char (A.                        Registration_date, ' mm ') '; "); //SQL. Append ("END;");                    ////Clinical evaluation of image quality                    //SQL. Append ("Begin");Sql. Append (@"open:var_3 for ' SELECT COUNT (*) NUM, NVL (b.clinic_image_quality,2) Quality,to_char (a.registration_date, ' mm ') MONTH from Patient_registration A left JOIN quality_evaluation B on a.registration_id=b.reg_id WHERE to_char (A.regis Tration_date, ' Yyyy-mm-dd hh:mi:ss ') >= '"+start_date+"' and To_char (a.registration_date, ' yyyy-mm-dd hh:mi:ss ') <= '"+end_date+""and modality=""+modality+""and hospital_id=""+hospital_id+""'")                     . Append (@"GROUP by B.clinic_image_quality,to_char (a.registration_date, "mm") ORDER by B.clinic_image_quality,to_char (A.                       Registration_date, ' mm ') '; "); //SQL. Append ("END;");                    ////Clinical Report Quality evaluation                    //SQL. Append ("Begin");Sql. Append (@"open:var_4 for ' SELECT COUNT (*) NUM, NVL (b.clinic_report_quality,2) Quality,to_char (a.registration_date, ' mm ') MONTH from Patient_registration A left JOIN quality_evaluation B on a.registration_id=b.reg_id WHERE to_char (A.regis Tration_date, ' Yyyy-mm-dd hh:mi:ss ') >= '"+start_date+"' and To_char (a.registration_date, ' yyyy-mm-dd hh:mi:ss ') <= '"+end_date+""and modality=""+modality+""and hospital_id=""+hospital_id+""'")                                 . Append ("GROUP by B.clinic_report_quality,to_char (a.registration_date, "mm") ORDER by B.clinic_report_quality,to_char (A .   Registration_date, ' mm ') '; "); Sql. Append ("end;"); varp =NewOracleParameter (": var_1", Oracledbtype.refcursor); P.direction=ParameterDirection.Output; paras.                    ADD (P); varP2=NewOracleParameter (": var_2", Oracledbtype.refcursor); P2. Direction=ParameterDirection.Output; paras.                    ADD (p2); varp3=NewOracleParameter (": Var_3", Oracledbtype.refcursor); P3. Direction=ParameterDirection.Output; paras.                    ADD (p3); varp4=NewOracleParameter (": Var_4", Oracledbtype.refcursor); P4. Direction=ParameterDirection.Output; paras.                    ADD (p4); DS=DBHelper. Query (SQL.                    ToString (), paras);  Break; default: Break; }                                   returnds; The above code returns 4 datasets. Don't note, open:var_1. for"Inside the statement, all the single quotes will be converted into two single quotes."

Oracle multiple statements executed simultaneously (e.g. two datasets returned)

Related Article

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.