PL/SQLÖÐRef CursorµÄÓ¦ÓÃ
PL/SQL×÷Ϊoracle¶ÔÓÚ´«Í³SQLÓï·¨µÄÀ©Õ¹,ÔÚ¿çϵͳÊÂÎñ´¦ÀíÒÔ¼°¶ÔÊý¾Ý¿â´óÅúÁ¿Êý¾Ý´¦Àí·½Ãæ×÷ÓÃÏÔÖø;¶øµ±Ç°Ö÷Á÷µÄMVC¿ò¼Ü¶ÔDAO²ãµÄ·â×°¶¼ÊÇÒ»ÌõSQLÓï¾ä·µ»ØÒ»¸ö¼Ç¼¼¯;µ±Êý¾ÝµÄ¹Øϵ±È½Ï¸´ÔÓ»òÊý¾ÝÁ¿±È½Ï´óµÄʱºò,ÓëÊý¾Ý¿âµÄ½»»¥¹ýÓÚƵ·±½«Ôö´óÄÚÍøµÄÊý¾Ý´«ÊäÁ¿ÓëÊý¾Ý¿âµÄIO.Õë¶Ô´ËÀิÔÓµÄÊý¾Ý´¦Àí,¿ÉÒÔ²ÉÓÃPL/SQL³ÌÐò°üÀ´ÊµÏÖÆäÒµÎñÂß¼.
ÄÜÔÚ×Ó³ÌÐòÖ®¼ä¹²ÏíÊý¾ÝµÄref cursorÔÚÕâ·½ÃæºÝ´óÓÅÊÆ,ÏÂÃæÊÇÎÒ×Ô¼ºÐ´µÄÒ»¸öÀý×Ó:
³ÌÐò°üÍ·:
Create or replace Package WesleyPackage
as
Type Test_CURSOR IS REF CURSOR;
Procedure SelectByProcedure( QueryRecordNumStatment1 in varchar ,QueryTotalRecordInfoStatment2 in varchar , QueryPageInfoStatment3 in varchar,CurrentPage4 in number , ShowRange5 in number , RecordNum6 out number ,TotalInfoRS7 out WesleyPackage.Test_CURSOR, PageInfoRS8 out WesleyPackage.Test_CURSOR );
End WesleyPackage;
³ÌÐò°üÌå:
--´øÓÐout²ÎÊýµÄ´æ´¢¹ý³Ì±ØÐëͨ¹ýjava jdbcµÄCallableStatementµ÷Ó÷½Ê½´òÓ¡Êä³ö½á¹û
--´æ´¢¹ý³ÌµÄ²ÎÊý²»ÄÜΪ ibatisÖÐµÄ po¶ÔÏó
Set serveroutput on;
Create or replace Package Body WesleyPackage as
Procedure SelectByProcedure( QueryRecordNumStatment1 in varchar
,QueryTotalRecordInfoStatment2 in varchar
, QueryPageInfoStatment3 in varchar,CurrentPage4 in number
, ShowRange5 in number , RecordNum6 out number
,TotalInfoRS7 out WesleyPackage.Test_CURSOR
, PageInfoRS8 out WesleyPackage.Test_CURSOR ) as --×¢ÒâûÓÐCreate
beginRowNum number;--µ±Ç°Ò³µÄÊ×Ìõ¼Ç¼µÄÐòºÅ
endRowNum number; --µ±Ç°Ò³µÄÄ©Ìõ¼Ç¼µÄÐòºÅ
showNum number; --¸ù¾Ý²éѯµÃµ½µÄ×ÜÌõÊýºÍÏÔʾ·¶Î§µÃµ½µÄÒ»¸ö½ÏСֵ
showRecordPerPage number:= 30;--ÿҳÏÔʾµÄÌõÊý
pageSQL varchar2(300);
Begin
execute immediate to_char(QueryRecordNumStatment1) i
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
ÒýÓÃ
show me µÄ SQL SERVERÃüÁî´óÈ«£¨ÖµµÃѧϰµÄ¶«Î÷£©
--Óï ¾ä ¹¦ ÄÜ
--Êý¾Ý²Ù×÷
SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
INSERT --ÏòÊý¾Ý¿â±íÌí¼ÓÐÂÊý¾ÝÐÐ
DELETE --´ÓÊý¾Ý¿â±íÖÐɾ³ýÊý¾ÝÐÐ
UPDATE --¸üÐÂÊý¾Ý¿â±íÖеÄÊý¾Ý
--Êý¾Ý¶¨Òå
CREATE TABLE --´´½¨Ò»¸öÊý¾Ý¿â±í
DROP TABLE --´ÓÊý¾Ý¿âÖÐɾ³ý±í
ALTER T ......
QL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ ......
ת×Ô£ºhttp://topic.csdn.net/u/20100109/09/70f82fb7-eabc-4140-9573-5f8395e0f62e.html
²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
¡¡¡¡1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡ ......
¼òµ¥µØ˵£¬¾ÍÊÇ´ÓCDMÉú³ÉPDMµÄʱºò£¬releationshipÔ¼ÊøÎÞЧ£¬²»ÄÜÉú³ÉÍâ¼üÔ¼ÊøµÄ´úÂë¡£Éú³É»ùÓÚoracleµÄpdmûÎÊÌ⣬ms sql serverÓÐÎÊÌâ
ÕâÀïµÄÊÇsql server 2005
Power DesignerÊÇ15.0.0.2613
¿´Æð來ÊÇPDµÄbug,½â決辦·¨ÊÇÔÚPDM畫ÃæÖÐ點選Model->References...
會Ìø³öÒ ......