资源描述:
《oracle与sql脚本区别》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、ORACLE与SQL脚本区别1、在SQL中,SQL参数前面用@,Oracle参数前面使用:。2、字段对应。SQLOracle大文本类型NtextNClob二进制数据ImageBLOB3、在Sql中,多个sql语句之间不需要使用符号分开,在Oracle中,语句之间需要用;分开,前面需要加begin后面需要加end;(如:begin语句1;语句2;end;)4、自增长字段处理.在Sql中有自增长字段,在Oracel中没有自增长字段,我们需要建立一个序列(Sequence),命名方式:sq_+对应当数据表名(如:sq_DBMail_AllMails)。使用比较:Sql中:INSERTINTODB
2、Mail_AllMails(MailGuid,FromUserGuid,FromDispName,ToUserGuidList,ToUserDispNameList,Subject,MailContent,OwnerUserGuid,SendTime,mailTypeName,mailTypeId,deleteFlag,HasAttach,Importance,BoxTypeGuid,OutMailGuid)VALUES(@MailGuid,@FromUserGuid,@FromDispName,@ToUserGuidList,@ToUserDispNameList,@Subject,@M
3、ailContent,@OwnerUserGuid,@SendTime,@mailTypeName,@mailTypeId,@deleteFlag,@HasAttach,@Importance,@BoxTypeGuid,@OutMailGuid)Oracle中:INSERTINTODBMail_AllMails(Row_ID,MailGuid,FromUserGuid,FromDispName,ToUserGuidList,ToUserDispNameList,Subject,MailContent,OwnerUserGuid,SendTime,mailTypeName,mailTypeI
4、d,deleteFlag,HasAttach,Importance,BoxTypeGuid,OutMailGuid)VALUES(sq_DBMail_AllMails.nextval,:MailGuid,:FromUserGuid,:FromDispName,:ToUserGuidList,:ToUserDispNameList,:Subject,:MailContent,:OwnerUserGuid,:SendTime,:mailTypeName,:mailTypeId,:deleteFlag,:HasAttach,:Importance,:BoxTypeGuid,:OutMailGui
5、d)。如果需要返回值,参考方法:publicintInsert(stringResourceName){Databasedb=DatabaseFactory.CreateDatabase(Conn.GetConnectionString("OAMisc_ConnectionString"));stringstrSql=((db.DbProviderFactory.ToString()!="System.Data.OracleClient.OracleClientFactory")?"INSERTINTOMisc_Schedule_Resource(ResourceName)VALUES(@
6、ResourceName)SELECT@ResourceID=SCOPE_IDENTITY()":"beginselectsq_Misc_Schedule_Resource.Nextvalinto:ResourceIDfromdual;INSERTINTOMisc_Schedule_Resource(ResourceID,ResourceName)VALUES(:ResourceID,:ResourceName);end;");DbCommandcmd=db.GetSqlStringCommand(strSql);db.AddInParameter(cmd,"ResourceName",D
7、bType.String,ResourceName);db.AddOutParameter(cmd,"ResourceID",DbType.Int32,0);db.ExecuteNonQuery(cmd);intreturnId=Convert.ToInt32(db.GetParameterValue(cmd,"ResourceID"));returnreturnId;}1、Sql中不区分大小写,Oracle中区分的,用