[英]Changing from SQL Server to Oracle database
I've been asked to migrate my application from using a SQL Server database to an Oracle database. 我被要求将我的应用程序从使用SQL Server数据库迁移到Oracle数据库。
I'm getting this error: 我收到此错误:
ORA-00942: table or view does not exist
ORA-00942:表或视图不存在
I could be wrong, but I believe this is an issue with my statement. 我可能是错的,但是我认为这是我的陈述中存在的问题。 Is there a specific format I would need to follow connected to an oracle database over a SQL Server?
通过SQL Server连接到oracle数据库是否需要遵循特定的格式?
I will include my query statement: 我将包括我的查询语句:
namespace project1
{
public class dbqry
{
private static string qry = "";
public static DataTable gProjectCIS(string BSA_CD)
{
qry = string.Format(@"SELECT *
FROM CIS_TRANS
WHERE BSA_CD like '%{0}%'", BSA_CD);
return dbcon.GetDataTable(qry, "ProjectCISConnectionString");
}
public static DataTable gProjectCIS()
{
qry = @"SELECT *
FROM CIS_TRANS";
return dbcon.GetDataTable(qry, "ProjectCISConnectionString");
}
Thanks! 谢谢!
Hello you must prefix your table with schema 您好,您必须为表添加模式
qry = string.Format(@"SELECT *
FROM YourSchemaUser.CIS_TRANS <-- Fix your schema user name
WHERE BSA_CD like '%{0}%'", BSA_CD);
qry = @"SELECT * FROM YourSchemaUser.CIS_TRANS"; <-- Fix your schema user name
And Fix Package on stored procedure. 并在存储过程中修复程序包。
You change declaration and body, compile your package in the first time before use 您更改声明和正文,在使用前第一次编译您的包
Oracle is picky when it comes to case sensitivity. 在区分大小写方面,Oracle十分挑剔。 If the table was declared with "QUOTES", you'll need to include the quotes in your query and match case.
如果表是用“ QUOTES”声明的,则需要在查询和匹配用例中包括引号。 That's probably a good start.
那可能是一个好的开始。
Check the object names. 检查对象名称。 Also check they are in the correct case.
还要检查它们的大小写是否正确。
Check that the username you are using to connect to the database have permissions over the tables/views you are trying to use. 检查用于连接数据库的用户名是否对您尝试使用的表/视图具有权限。 Oracle usually says that the table does not exist when you don't have the right privileges.
Oracle通常会说,如果您没有正确的特权,则该表不存在。
您确定要登录正确的架构吗?
You should check whether the CIS_TRANS table has the appropraite public synonym, something like: 您应该检查CIS_TRANS表是否具有适当的公共同义词,例如:
create or replace public synonym CIS_TRANS for some_user.CIS_TRANS
where some_user is the user which created the CIS_TRANS object. 其中some_user是创建CIS_TRANS对象的用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.