ÏÂÔغó½âѹËõ¾ÍÄÜÖ±½ÓʹÓÃÁË£¬µ«ÊÇÊÇÖÐÎĵģ¬×ÖÌåÏÔʾµÄ²»ÊǺܺã¬ÓÚÊÇÕÒµ½ÁË»»Ó¢Îĵİ취£º
ÓÉÓÚ1.5°üº¬Á˶àÓïÑÔ½çÃæµÄÖ§³Ö£¬µ«ÊÇËüÊÇͨ¹ýJVMÀ´±æÈÏϵͳÓïÑԵģ¬ËùÒÔµ±ÄãµÄϵͳÓïÑÔΪÖÐÎĵÄʱºò£¬Ëü»áʹÓÃÖÐÎĽçÃæ¡£²»¹ýËüµÄÖÐÎÄ·Òë²¢²»ÍêÕû£¬¼ÓÉÏĬÈϽçÃæ×ÖÌå̫С£¬Ê¹ÓÃÖÐÎĻῴ×ŷdz£ÄÑÊÜ¡£Èç¹ûÏëʹÓÃÓ¢ÎĽçÃ棬ÐèÒªÐÞ¸ÄÏÂJVM²ÎÊý¡£
ÕÒµ½sqldeveloper\bin\sqldeveloper.conf,¼ÓÈë
AddVMOption -Duser.language=en
AddVMOption -Duser.country=US
ÆäËüµÄÐéÄâ²ÎÊý²ÎÊýÒ²¿ÉÒÔͨ¹ýÕâÖÖ·½Ê½´«µÝ¡£ ......
ÏÂÔغó½âѹËõ¾ÍÄÜÖ±½ÓʹÓÃÁË£¬µ«ÊÇÊÇÖÐÎĵģ¬×ÖÌåÏÔʾµÄ²»ÊǺܺã¬ÓÚÊÇÕÒµ½ÁË»»Ó¢Îĵİ취£º
ÓÉÓÚ1.5°üº¬Á˶àÓïÑÔ½çÃæµÄÖ§³Ö£¬µ«ÊÇËüÊÇͨ¹ýJVMÀ´±æÈÏϵͳÓïÑԵģ¬ËùÒÔµ±ÄãµÄϵͳÓïÑÔΪÖÐÎĵÄʱºò£¬Ëü»áʹÓÃÖÐÎĽçÃæ¡£²»¹ýËüµÄÖÐÎÄ·Òë²¢²»ÍêÕû£¬¼ÓÉÏĬÈϽçÃæ×ÖÌå̫С£¬Ê¹ÓÃÖÐÎĻῴ×ŷdz£ÄÑÊÜ¡£Èç¹ûÏëʹÓÃÓ¢ÎĽçÃ棬ÐèÒªÐÞ¸ÄÏÂJVM²ÎÊý¡£
ÕÒµ½sqldeveloper\bin\sqldeveloper.conf,¼ÓÈë
AddVMOption -Duser.language=en
AddVMOption -Duser.country=US
ÆäËüµÄÐéÄâ²ÎÊý²ÎÊýÒ²¿ÉÒÔͨ¹ýÕâÖÖ·½Ê½´«µÝ¡£ ......
¼ÆËã¼ä¸ôʱ¼ä£º
select f_date,f_cstime,f_cetime, (((SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')) * 86400000)-((SYSDATE- TO_DATE(f_date||f_cetime,'YYYYMMDDHH24MISS')) * 86400000))/1000 CURRENT_MILLI from ycsq_t_hauthlog where f_cstime<>'999999'
½«×Ö·û´®×ª»»³ÉÈÕÆÚÀà:SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS'),
SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')*86400000 ת»»³ÉºÁÃë ......
¼ÆËã¼ä¸ôʱ¼ä£º
select f_date,f_cstime,f_cetime, (((SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')) * 86400000)-((SYSDATE- TO_DATE(f_date||f_cetime,'YYYYMMDDHH24MISS')) * 86400000))/1000 CURRENT_MILLI from ycsq_t_hauthlog where f_cstime<>'999999'
½«×Ö·û´®×ª»»³ÉÈÕÆÚÀà:SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS'),
SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')*86400000 ת»»³ÉºÁÃë ......
1.µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/htdocs/winsoft.htmlÏÂÔØ
11.1.0.7.0 °æµÄ¼´Ê±¿Í»§¶Ë³ÌÐò°ü — Basic£¨²»ÊÇBasic Lite£©
2.½«ÏÂÔص½µÄÎļþ½âѹ£¬½âѹºóÎÒ½«Ä¿Â¼instantclient_11_1ÀïµÄÈ«²¿Îļþ¿½±´µ½ÁËÒ»¸öеÄĿ¼£ºE:\programs\OracleClient¡£ÄãÒ²¿ÉÒÔ²»¿½±´£¬Ö±½ÓʹÓýâѹºóµÄĿ¼Ãû¡£
3.´´½¨Îļþtnsnames.ora£¬ÄÚÈÝÈçÏ£º
APP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.22.6)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = app)
)
)
×¢£ºÐèÒª¸ü¸ÄµÄÊÇ£º1.°Ñ HOSTµÄÖµ172.22.22.6¸Ä³ÉÄãÒªÁ¬½ÓµÄÊý¾Ý¿âËùÔÚÖ÷»úµÄµØÖ·£»2.°ÑSERVICE_NAMEµÄÖµ¸Ä³ÉÄãҪʹÓõÄÔ¶³ÌÊý¾Ý¿âÃû
4.ÉèÖÃpl/sql DeveloperµÄperference¡£½«OracleµÄConnectionÀïµÄOracleÖ÷Ŀ¼ÉèÖÃΪÔÚµÚ2²½ÀïÉèÖõÄĿ¼£¬ÎÒµÄÊÇ£ºE:\programs\OracleClient£¬Í¬Ê±½«OCI¿âÉèÖÃΪE:\programs\OracleClient\oci.dll
5.ÉèÖû·¾³±äÁ¿¡ ......
1.µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/htdocs/winsoft.htmlÏÂÔØ
11.1.0.7.0 °æµÄ¼´Ê±¿Í»§¶Ë³ÌÐò°ü — Basic£¨²»ÊÇBasic Lite£©
2.½«ÏÂÔص½µÄÎļþ½âѹ£¬½âѹºóÎÒ½«Ä¿Â¼instantclient_11_1ÀïµÄÈ«²¿Îļþ¿½±´µ½ÁËÒ»¸öеÄĿ¼£ºE:\programs\OracleClient¡£ÄãÒ²¿ÉÒÔ²»¿½±´£¬Ö±½ÓʹÓýâѹºóµÄĿ¼Ãû¡£
3.´´½¨Îļþtnsnames.ora£¬ÄÚÈÝÈçÏ£º
APP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.22.6)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = app)
)
)
×¢£ºÐèÒª¸ü¸ÄµÄÊÇ£º1.°Ñ HOSTµÄÖµ172.22.22.6¸Ä³ÉÄãÒªÁ¬½ÓµÄÊý¾Ý¿âËùÔÚÖ÷»úµÄµØÖ·£»2.°ÑSERVICE_NAMEµÄÖµ¸Ä³ÉÄãҪʹÓõÄÔ¶³ÌÊý¾Ý¿âÃû
4.ÉèÖÃpl/sql DeveloperµÄperference¡£½«OracleµÄConnectionÀïµÄOracleÖ÷Ŀ¼ÉèÖÃΪÔÚµÚ2²½ÀïÉèÖõÄĿ¼£¬ÎÒµÄÊÇ£ºE:\programs\OracleClient£¬Í¬Ê±½«OCI¿âÉèÖÃΪE:\programs\OracleClient\oci.dll
5.ÉèÖû·¾³±äÁ¿¡ ......
ÔÚʹÓÃODP.NET½øÐÐOracle±à³Ìʱ£¬ÓÐʱºòSQLÓï¾ä·Ç³£¸´ÔÓ£¬ÐèÒª²ÉÓö¯Ì¬¹¹Ôì²éѯÓï¾äµÄÇé¿ö£¬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ¹¹Ô춯̬µÄSQLÓï¾ä£¬²¢Ö´Ðзµ»Ø½á¹û¼¯¡£
1¡¢ÔÚÊý¾Ý·ÃÎʲ㹹ÔìSQLÓï¾ä
ÀýÈçÏÂÃæµÄÓï¾ä£¬½«¹¹ÔìÍêÕûµÄSQLÓï¾ä¸³Öµ¸øCommandText£¬ÔÙ´«µÝµ½Êý¾Ý¿â½øÐÐÖ´ÐУ¬·µ»Ø½á¹û¼¯¡£
loadCommand.CommandType = CommandType.Text
loadCommand.CommandText = "Select * from Users"
dataAdapter .SelectCommand = loadCommand
dataAdapter . Fill(data)
dataAdapter .SelectCommand = loadCommand
dataAdapter . Fill(data)
¸Ã·½·¨ÐèÒª½«Õû¸öSQLµÄ¹¹Ôì¹ý³Ì·ÅÔÚDataAccess²ã£¬ÒµÎñÂß¼·¢Éú±ä»¯£¬Ð޸IJ»·½±ã£¬¶øÇÒÿ´Î²éѯÐèÒª´«µÝ¸øÊý¾Ý¿âºÜ³¤µÄ²éѯ×Ö·û´®£¬´«µÝ²ÎÊýµÄЧÂÊÒ²²»¸ß¡£
2¡¢ÔÚ´æ´¢¹ý³ÌÖй¹Ô춯̬SQLÓï¾ä²¢Ö´ÐÐ
ÒÔÏÂΪһ¸öÍêÕûµÄÊÂÀý£¨¾¹ýɾ¼õ£©£¬ÆäÖÐRefCursor Ϊ×Ô¶¨ÒåÓαêÀàÐÍ
PROCEDURE G_Search(P_YearNO IN NUMBER,
& ......
ÔÚʹÓÃODP.NET½øÐÐOracle±à³Ìʱ£¬ÓÐʱºòSQLÓï¾ä·Ç³£¸´ÔÓ£¬ÐèÒª²ÉÓö¯Ì¬¹¹Ôì²éѯÓï¾äµÄÇé¿ö£¬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ¹¹Ô춯̬µÄSQLÓï¾ä£¬²¢Ö´Ðзµ»Ø½á¹û¼¯¡£
1¡¢ÔÚÊý¾Ý·ÃÎʲ㹹ÔìSQLÓï¾ä
ÀýÈçÏÂÃæµÄÓï¾ä£¬½«¹¹ÔìÍêÕûµÄSQLÓï¾ä¸³Öµ¸øCommandText£¬ÔÙ´«µÝµ½Êý¾Ý¿â½øÐÐÖ´ÐУ¬·µ»Ø½á¹û¼¯¡£
loadCommand.CommandType = CommandType.Text
loadCommand.CommandText = "Select * from Users"
dataAdapter .SelectCommand = loadCommand
dataAdapter . Fill(data)
dataAdapter .SelectCommand = loadCommand
dataAdapter . Fill(data)
¸Ã·½·¨ÐèÒª½«Õû¸öSQLµÄ¹¹Ôì¹ý³Ì·ÅÔÚDataAccess²ã£¬ÒµÎñÂß¼·¢Éú±ä»¯£¬Ð޸IJ»·½±ã£¬¶øÇÒÿ´Î²éѯÐèÒª´«µÝ¸øÊý¾Ý¿âºÜ³¤µÄ²éѯ×Ö·û´®£¬´«µÝ²ÎÊýµÄЧÂÊÒ²²»¸ß¡£
2¡¢ÔÚ´æ´¢¹ý³ÌÖй¹Ô춯̬SQLÓï¾ä²¢Ö´ÐÐ
ÒÔÏÂΪһ¸öÍêÕûµÄÊÂÀý£¨¾¹ýɾ¼õ£©£¬ÆäÖÐRefCursor Ϊ×Ô¶¨ÒåÓαêÀàÐÍ
PROCEDURE G_Search(P_YearNO IN NUMBER,
& ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
ʵ¼ÊÓ¦ÓÃÖÐÎÒÃÇ¿ÉÒÔͨ¹ýsum()ͳ¼Æ³ö×éÖеÄ×ܼƻòÕßÊÇÀÛ¼ÓÖµ£¬¾ßÌåʾÀýÈçÏ£º
1.´´½¨ÑÝʾ±í
create table emp
as
select * from scott.emp;
alter table emp
add constraint emp_pk
primary key(empno);
create table dept
as
select * from scott.dept;
alter table dept
add constraint dept_pk
primary key(deptno);
2. sum()Óï¾äÈçÏ£º
select deptno,
ename,
sal,
¡¡¡¡--°´ÕÕ²¿ÃÅнˮÀÛ¼Ó£¨order by¸Ä±äÁË·ÖÎöº¯ÊýµÄ×÷Óã¬Ö»¹¤×÷ÔÚµ±Ç°ÐкÍÇ°Ò»ÐУ¬¶ø²»ÊÇËùÓÐÐУ©
sum(sal) over (partition by deptno order by sal) ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
ʵ¼ÊÓ¦ÓÃÖÐÎÒÃÇ¿ÉÒÔͨ¹ýsum()ͳ¼Æ³ö×éÖеÄ×ܼƻòÕßÊÇÀÛ¼ÓÖµ£¬¾ßÌåʾÀýÈçÏ£º
1.´´½¨ÑÝʾ±í
create table emp
as
select * from scott.emp;
alter table emp
add constraint emp_pk
primary key(empno);
create table dept
as
select * from scott.dept;
alter table dept
add constraint dept_pk
primary key(deptno);
2. sum()Óï¾äÈçÏ£º
select deptno,
ename,
sal,
¡¡¡¡--°´ÕÕ²¿ÃÅнˮÀÛ¼Ó£¨order by¸Ä±äÁË·ÖÎöº¯ÊýµÄ×÷Óã¬Ö»¹¤×÷ÔÚµ±Ç°ÐкÍÇ°Ò»ÐУ¬¶ø²»ÊÇËùÓÐÐУ©
sum(sal) over (partition by deptno order by sal) ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
Èç¹ûÎÒÃÇ°´ÕÕʾÀýÏëµÃµ½Ã¿¸ö²¿ÃÅнˮֵ×î¸ßµÄ¹ÍÔ±µÄ¼Í¼£¬¿ÉÒÔÓÐËÄÖÖ·½·¨ÊµÏÖ£º
ÏÈ´´½¨Ê¾Àý±í
create table emp
as
select * from scott.emp;
alter table emp
add constraint emp_pk
primary key(empno);
create table dept
as
select * from scott.dept;
alter table dept
add constraint dept_pk
primary key(deptno);
·½·¨1.empÖеÄÿһÐж¼»á½øÐÐmax±È½Ï£¬·Ñʱ
select * from emp emp1 where emp1.sal=(select max(emp2.sal) from emp emp2 where emp2.deptno=emp1.deptno)
·½·¨2.ÏÈ×Ó²éѯ²éÕÒ³ömax sal£¬È»ºóÓëemp±íÏà¹ØÁª£¬Èç¹ûÂß¼¸´ÔÓ»á²úÉú½Ï¶à´úÂë
select * from emp emp1,(select de ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
Èç¹ûÎÒÃÇ°´ÕÕʾÀýÏëµÃµ½Ã¿¸ö²¿ÃÅнˮֵ×î¸ßµÄ¹ÍÔ±µÄ¼Í¼£¬¿ÉÒÔÓÐËÄÖÖ·½·¨ÊµÏÖ£º
ÏÈ´´½¨Ê¾Àý±í
create table emp
as
select * from scott.emp;
alter table emp
add constraint emp_pk
primary key(empno);
create table dept
as
select * from scott.dept;
alter table dept
add constraint dept_pk
primary key(deptno);
·½·¨1.empÖеÄÿһÐж¼»á½øÐÐmax±È½Ï£¬·Ñʱ
select * from emp emp1 where emp1.sal=(select max(emp2.sal) from emp emp2 where emp2.deptno=emp1.deptno)
·½·¨2.ÏÈ×Ó²éѯ²éÕÒ³ömax sal£¬È»ºóÓëemp±íÏà¹ØÁª£¬Èç¹ûÂß¼¸´ÔÓ»á²úÉú½Ï¶à´úÂë
select * from emp emp1,(select de ......