Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle OCI programming and Borland C++ Builder

As you may know, Oracle dropped support for Borland Compilers in OCI
some time back. Well, it isn't all that hard to set up again.
I'm running 9i Release 2 Enterprise Edition on this PC at work and I am
using Borland C++ Builder 6 to 'play' with OCI programming - I intend to
build a set of components eventually, but I need to know what I'm doing
first !
I remember trying in the past to get OCI to work - but had no luck,
however, this time I decided not to give in so easily. I was depressed
to find that the old Borland folder under <oracle_hjome>\oci\lib has
gone - looks like only MS Visual C is supported - and we all know that
MS and Borland have a different OMF format and there is much wailing and
gnashing of teeth to get Borland talking to DLLs etc created with MSVC
and vice versa.
There are docs on Metalink which go into great detail about these
differences and how it can screw up your life to use a Borland compiler
- but I suspect these are now out of date.
Here is what you have to do instead (the following uses my paths -
adjust for your setup) :
Open a DOS window
cd e:\oracle\ora92\oci\lib
mkdir borland
cd borland
Assuming that the CBuilder bin directory is on your path .....
implib -a oci.lib <oracle_home>\bin\oci.dll
exit
That has created an import library to be added to any OCI projects you
want to create. The '-a' bit is required as it prepends an underscore to
the exported module names in the dll. This is what used to cause so many
problems with MS/Borland libraries and stuff in the past.
The rest is simple, run up C++ Builder and open one of the Oracle
samples - I used CDemo6 - you'll be asked to create a project to run it,
do so then save it as BOR_CDemo6.
Project | options and on the directories tab, add
<oracle_home>\oci\include to the includes path.
Then Project | add to project and add <oracle_home>\oci\borland\oci.lib
to the project.
Compile & run - et viola (as French musicians would


Ïà¹ØÎĵµ£º

Oracle 10g ÕýÔò±í´ïʽ


ORACLEÖÕÓÚÔÚ10GÖÐÌṩÁ˶ÔÕýÔò±í´ïʽµÄÖ§³Ö£¬ÒÔÇ°ÄÇЩÐèҪͨ¹ýLIKEÀ´½øÐеĸ´ÔÓµÄÆ¥Åä¾Í¿ÉÒÔͨ¹ýʹÓÃÕýÔò±í´ïʽ¸ü¼òµ¥µÄʵÏÖ¡£
Oracle 10gÕýÔò±í´ïʽÌá¸ßÁËSQLÁé»îÐÔ¡£ÓÐЧµÄ½â¾öÁËÊý¾ÝÓÐЧÐÔ£¬ Öظ´´ÊµÄ±æÈÏ, Î޹صĿհ׼ì²â£¬»òÕß·Ö½â¶à¸öÕýÔò×é³ÉµÄ×Ö·û´®µÈÎÊÌâ¡£
Oracle 10gÖ§³ÖÕýÔò±í´ïʽµÄË ......

»ñÈ¡Oracle ±íÐÅÏ¢ Õû³ÉÊý¾Ý×Öµä

 ½ñÌìXXX˵Ҫ°ÑOracle ÀïµÄ¼¸ÕűíÖØÐÂÕûÀíÏ£¬ºÇºÇ ½á¹û°¢·¢ÏÖ10À´ÕÅ±í»¹ÕæÊÇ˵¶à²»¶à˵ÉÙÒ»µã¶¼²»ÉÙ ¡£ÒòΪ±íÀïÃæµÄcommetÒѾ­ÌîÉÏÁË ¡£ÍµÀÁµÄÏë·¨¶Ùʱ³öÏָ¸Â
select t.COLUMN_NAME ×Ö¶ÎÃû, t.DATA_TYPE||'('||t.DATA_LENGTH||')' ×Ö¶ÎÀàÐÍ,t.NULLABLE ÊÇ·ñΪ¿Õ,t.DATA_DEFAULT ĬÈÏÖµ,p.comments ×Ö¶Î˵Ã÷
fro ......

oracle ÖеÄminus

 minusÔËËã
·µ»ØÔÚµÚÒ»¸ö²éѯ½á¹ûÖÐÓëµÚ¶þ¸ö²éѯ½á¹û²»ÏàͬµÄÄDz¿·ÖÐмǼ¡£
ÓÐÄÄЩ¹¤ÖÖÔڲƻᲿÖÐÓУ¬¶øÔÚÏúÊÛ²¿ÖÐûÓУ¿
exp:selectjobfromaccount
minus
selectjobfromsales;
ÓëunionÏà·´ ......

Àí½â¸´ÔÓµÄC/C++ÉùÃ÷ const, typedef , º¯ÊýÖ¸Õë

 ÈÃÎÒÃÇ´ÓÒ»¸ö·Ç³£¼òµ¥µÄÀý×Ó¿ªÊ¼£¬ÈçÏ£º
int n;
Õâ¸öÓ¦¸Ã±»Àí½âΪ“declare n as an int”£¨nÊÇÒ»¸öintÐ͵ıäÁ¿£©¡£
½ÓÏÂÈ¥À´¿´Ò»ÏÂÖ¸Õë±äÁ¿£¬ÈçÏ£º
int *p;
Õâ
¸öÓ¦¸Ã±»Àí½âΪ“declare p as an int *”£¨pÊÇÒ»¸öint
*Ð͵ıäÁ¿£©£¬»òÕß˵pÊÇÒ»¸öÖ¸ÏòÒ»¸öintÐͱäÁ¿µÄÖ¸Õë¡£ÎÒÏëÔÚÕ ......

Oracle SQLÓï¾ä

ORDER BY ÅÅÐò
 
ASC ÉýÐò(ĬÈÏ)
 DESC ½µÐò
 
select * from s_emp order by dept_id , salary desc
²¿ÃźÅÉýÐò£¬¹¤×ʽµÐò
¹Ø¼ü×ÖdistinctÒ²»á´¥·¢ÅÅÐò²Ù×÷¡£
 
select * from employee order by 1; //°´µÚÒ»×Ö¶ÎÅÅÐò
NULL±»ÈÏΪÎÞÇî´ó¡£order by ¿ÉÒÔ¸ú±ðÃû¡£
 
select table_name ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ