Pro*C ÖÐǶÈëpl/sql¿é
/* °üº¬CÍ·Îļþ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* °üº¬SQLCAÍ·Îļþ */
EXEC SQL INCLUDE sqlca;
EXEC SQL INCLUDE sqlda;
int main()
{
EXEC SQL BEGIN DECLARE SECTION;
int money;
char answerbuff[200];
int flag;
EXEC SQL END DECLARE SECTION;
/*
* ¶¨ÒåÊäÈëËÞÖ÷±äÁ¿:½ÓÊÕÓû§Ãû¡¢¿ÚÁîºÍÍøÂç·þÎñÃû
*
*/
char username[10],password[10],server[10];
strcpy(username,"data_center");
strcpy(password,"data_center");
strcpy(server,"oradf1"); /*ÕâÀïÌîдµÄÊÇÊý¾Ý¿âµÄSID*/
/* Á¬½Óµ½Êý¾Ý¿â */
EXEC SQL CONNECT :username IDENTIFIED BY :password USING :server;
if (sqlca.sqlcode==0)
printf("Á¬½Ó³É¹¦!\n");
else
/* ÏÔʾÁ¬½Ó´íÎóÏûÏ¢ */
printf("%.*s\n", sqlca.sqlerrm.sqlerrml,
sqlca.sqlerrm.sqlerrmc);
/*³õʼ»¯*/
money=0;
flag=0; /*ÓÃÌìÅжÏÊÇ·ñÕÒµ½Êý¾Ý*/
/*Ö´ÐÐplsql¿é*/
EXEC SQL EXECUTE
BEGIN
SELECT salary INTO :money from plsqltest WHERE name='ht';
:flag:=1;
EXCEPTION
WHEN NO_DATA_FOUND THEN
:answerbuff:='Êý¾ÝûÓÐÕÒµ½';
END;
END-EXEC;
/*Êä³ö½á¹û*/
Ïà¹ØÎĵµ£º
Visual C#Öж¯Ì¬²Ù×÷SQL ServerÊý¾Ý¿â £¨1£©
·¢²¼Ê±¼ä£º2003.01.14 10:09 À´Ô´£ºÈüµÏÍø ×÷ÕߣºÍõ¿Ã÷
ÔÚ±àдÊý¾Ý¿âÓ¦ÓóÌÐòµÄʱºò£¬ÎÒÃÇ¿ÉÒÔͨ¹ýSQLÓï¾äÀ´¶¯Ì¬´´½¨¡¢ÐÞ¸ÄÊý¾Ý¿âÒÔ¼°ÆäÖеĶÔÏó¡£±¾ÎÄÎÒ¾ÍÏò´ó¼Ò½éÉÜÈçºÎÔËÓÃVisual C#À´¶¯Ì¬²Ù×÷SQL ServerÊý¾Ý¿ ......
--Excelµ¼Èësql´æ´¢¹ý³Ì£¨¼òµ¥£©
Create procedure import
@tablename varchar(100),
@filepath varchar(100)
as
EXEC( 'INSERT INTO ' + @tablename +
' SELECT * from
OpenDataSource( ''Microsoft.Jet.OLEDB.4.0'',''Data Source="' + @filepath + '";
......
JavaÊý¾ÝÀàÐÍ
HibernateÊý¾ÝÀàÐÍ
±ê×¼SQLÊý¾ÝÀàÐÍ
byte
byte
TINYINT
short
short
SMALLINT
int
integer
INGEGER
long
long
BIGINT
float
float
FLOAT
double
double
DOUBLE
java.math.BigDecimal
big_decimal
NUMERIC
char, java.lang.Character
character
CHAR(1)
boolean, java.lang.Boole ......
SQL²Ù×÷È«¼¯
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE ......