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

[ת] proc oracle Á¬½ÓÊͷŲ»Á˵ÄÎÊÌâ

ת×Ô£ºhttp://www.91linux.com/html/article/database/oracle/20081205/14333.html
proc oracle Á¬½ÓÊͷŲ»Á˵ÄÎÊÌâ
±ÊÕß¹«Ë¾µÄÓ¦ÓÃϵͳÿ¸ôÒ»¶Îʱ¼ä£¬oracleÁ¬½Ó¾Í´ïµ½ÉÏÏÞÁË£»»³ÒÉÊÇÓ¦ÓÃûÓÐÕýÈ·µÄÊÍ·ÅoracleÁ¬½Ó£»ËµÀ´²ÑÀ¢£¬proc¶Ï¶ÏÐøÐøµÄÓÃÁ˼¸Ä꣬¿É
ÄÜÊÇÒÔÇ°¹«Ë¾µÄ´úÂëдµÃÌ«ºÃÁË£¬´ÓûÓÐÈ¥¹ØÐÄ»ù±¾µÄprocÁ¬½Ó¡¢ÊÍ·ÅÊÇÔõô´¦ÀíµÄ£¬ÕâÎÊÌâ±ÆµÃÎÒµÃÈ¥ÊìϤÕâ·½ÃæµÄ¶«Î÷ÁË£»ÅªÁËÁ½Ìì²ÅÕÒµ½ÎÊÌâµÄ¸ùÔ´£¬Æä
Öдó°ëʱ¼äÊÇÊìϤԭϵͳµÄ´úÂë¡¢¶¨Î»ÎÊÌ⣬ÆäËûʱ¼äÊÇÕÒÍøÉϵÄ×ÊÁÏ¿´¡¢×öÏà¹ØµÄ²âÊÔ£»
¾­¹ý·ÖÎö£¬½«ÎÊÌⶨλÔÚÁËÊý¾Ý¿â´ò¿ª¡¢¹Ø±ÕµÄÏà¹Øº¯Êý£»ºǫ́c++Ó¦Óõĸù±¾Ã»Óгɹ¦µÄÊÍ·Åoracle Á¬½Ó£¬Êý¾Ý¿â²Ù×÷º¯ÊýÈçÏ£º
sql_context db_open(const char* usr, const char* pwd)
{
EXEC SQL BEGIN DECLARE SECTION;
sql_context ctx;
char username[64];
char passwd[64];
EXEC SQL END DECLARE SECTION;
struct sqlca sqlca;
EXEC SQL ENABLE THREADS;
EXEC SQL CONTEXT ALLOCATE :ctx;
EXEC SQL CONTEXT USE :ctx;
strcpy(username,usr);
strcpy(passwd,pwd);
EXEC SQL CONNECT :username IDENTIFIED BY :passwd;
if (sqlca.sqlcode)
{
printf( "Á¬½ÓoracleÊý¾Ý¿âʧ°Ü!");
return NULL;
}
return ctx;
}
int db_close(sql_context ctx)
{
struct sqlca sqlca;
EXEC SQL CONTEXT FREE :ctx;
if( SQLCODE != 0 )
{
printf( "¶Ï¿ªÊý¾Ý¿âÁ¬½Óʧ°Ü!%d:%s\n",SQLCODE,sqlca.sqlerrm.sqlerrmc );
return -1;
}
return 0;
}
¾­¹ý²âÊÔ£¬·¢ÏÖÒÔÉÏdb_close¸ù±¾Ã»ÓÐÊÍ·ÅÊý¾Ý¿âÁ¬½Ó£»¾­¹ýºÍÍøÉÏʾ·¶³ÌÐòµÄ¶Ô±È£¬ÖÕÓÚ·¢ÏÖÁËÎÊÌ⣺
Ô­
À´oracle µÄsql context£¬ÐèÒª releaseÖ®ºó£¬²ÅÄÜÕýÈ·ÊÍ·ÅÊý¾Ý¿âÁ¬½Ó£»Èç¹û²»×örelease£¬free
context²»»á±¨ÈκδíÎ󣨼´db_closeÖв¢²»·µ»Ø-1£©£¬µ«ÊÇÊý¾Ý¿âÁ¬½ÓÈ´²»»áÊÍ·Å£¨¶ÔoracleµÄÕâ¸ö´¦Àí»úÖÆ£¬º¹Ò»¸ö-_-|||£¬»ò
Õß˵Ã÷ÎÒµÄproc±È½ÏÈõ°É£¬¿ÉÄÜ»¹ÓбðµÄ½â¾ö°ì·¨£©£»
°Ñdb_close¸Ä³ÉÈçÏ£¬ÎÊÌâ½â¾ö£º
int db_close(sql_context ctx)
{
struct sqlca sqlca;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE :ctx;
if( SQLCODE != 0 )
{
printf( "¶Ï¿ªÊý¾Ý¿âÁ¬½Óʧ°Ü!%d:%s\n",SQLCODE,sqlca.sqlerrm.sqlerrmc );
return -1;
}
return 0;
}
×¢Òâ


Ïà¹ØÎĵµ£º

JAVAÖÐOracleÈ¡Öµ

package com.svse.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UserDAO {
/*
* javaµ÷Óô洢¹ý³Ì
*/
public int addUser(String username,int userage)
{
Connection conn = null;
int useri ......

oracle¿Í»§¶ËÁ¬½Ó ORA 06413 Á¬½Óδ´ò¿ª´íÎó

½ñÌìÔÚһ̨2003serverÉÏ°²×° 9i¿Í»§¶Ë¡£
ÅäÖÃÁËtnsÖ®ºóÁ¬½Ó£¬±¨´í "ORA-06413 Á¬½Óδ´ò¿ª´íÎó".
°ÑÆäËü·þÎñÆ÷µÄtnsname.oraÖ±½Ó¿½±´¹ýÀ´Ò²²»ÐС£
ºóÀ´²éÁËÒ»ÏÂ×ÊÁÏ£¬ËµÓ¦ÓóÌÐò·¾¶Àï±ßÓÐÌØÊâ×Ö·û¡£
Õâ²Å»ÐÈ»´óÎò£¬Á½ÄêÇ°Õâ¸öÎÊÌâÒѾ­ÕÛÄ¥¹ýÎÒÒ»´ÎÁË£¬ÄÔ×Ó²»ºÃ£¬¾¹È»¸øÍüÁË¡£
Ô­Òò¾ÍÊÇ64λϵͳ»·¾³Ï°²×°oracle£¬oralc ......

ORACLE ÖÐROWNUMÓ÷¨×ܽá


    ¶ÔÓÚ Oracle µÄ rownum ÎÊÌ⣬ºÜ¶à×ÊÁ϶¼Ëµ²»Ö§³Ö>,>=,=,between...and£¬Ö»ÄÜÓÃÒÔÉÏ·ûºÅ(<¡¢<=¡¢!=)£¬²¢·Ç˵ÓÃ>,>=,=,between..and ʱ»áÌáʾSQLÓï·¨´íÎ󣬶øÊǾ­³£ÊDz鲻³öÒ»Ìõ¼Ç¼À´£¬»¹»á³öÏÖËƺõÊÇĪÃûÆäÃîµÄ½á¹ûÀ´£¬ÆäʵÄúÖ»ÒªÀí½âºÃÁËÕâ¸ö rownum αÁеÄÒâÒå¾Í²»Ó¦¸Ã¸Ðµ½¾ªÆæ£ ......

oracle ÖеÄexception

¡¡¡¡1¡¢Òì³£µÄÓŵã
¡¡¡¡
¡¡¡¡Èç¹ûûÓÐÒì³££¬ÔÚ³ÌÐòÖУ¬Ó¦µ±¼ì²éÿ¸öÃüÁîµÄ³É¹¦»¹ÊÇʧ°Ü£¬Èç
¡¡¡¡BEGIN
¡¡¡¡SELECT ...
¡¡¡¡-- check for ’no data found’ error
¡¡¡¡SELECT ...
¡¡¡¡-- check for ’no data found’ error
¡¡¡¡SELECT ...
¡¡¡¡-- check for ’no data found’ err ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ