I am creating a domain class in my grails application.This is my domain class
class StatTiming {
Date startTime
Date endTime
Date date
double percentageOnTariff
AutoPosting autoPosting
Status status
static constraints = {
startTime(nullable:false)
endTime(nullable:false)
date(nullable:false)
percentageOnTariff(nullable:false)
autoPosting(nullable:false)
status(nullable:false)
}
enum Status{ACTIVE,INACTIVE}
enum AutoPosting{SERVICE_CHARGE,STAT_CHARGES,BOTH}
}
Its working fine in hsqldb, but when i change database to Oracle its failed to create the table. I need to work in Oracle not hsqldb. An error is generated called "ORA-00904: : invalid identifier". Can anyone please tell me what is the problem here?
The problem is most likely with the field named date. That's a reserved word in Oracle.
(But without seeing the exact query, this is just a guess.)
Related
I am using SSIS for ETL. Source and destination databases are Oracle.
When I run job through SQL agent its prompts me with the following error:
This table contains 5 date columns which are creating this issue.
I have tried all possible solution but it didn't work. It does not seems data issue as I rerun job on those selective dates which worked perfectly. On full load it failed.
The bottom error message is:
Data Flow: Task:Error: SQLSTATE 22007, Message: [Microsoft][ODBC Oracle Wire Protocol driver]Invalid datetime format. Error in parameter 17.
You have an Invalid datetime format. You need to fix it by correcting either the data or the format model you are using but, since you haven't included any code, we can't help further.
I have a similar issue, the difference is my source is the SQL Server database and the destination is Oracle database.
I converted the source DateTime columns to type String first and then they were loaded to destination date columns successfully.
Looking into a query in WebIntelligence, after running, the prompts are replaced by values provided by user (for instance dates).
When I run the same query on Oracle (because this database I use for my universe) I’m getting error in terms of dates. Dates in query (in BO) are just strings,
like StartDate = '30-06-2020 00:00:00′. When I run the query generated in WebIntelligence on Oracle I’m getting error:
ORA-01843: not a valid month
01843. 00000 – ” not a valid month”
And to fix this I need to use for instance to_date function and then it’s working fine. My question is: how dates are parsed in WebIntelligence while running a query?
so the mentioned error does not occur?
I am getting the same error as you when I try a query directly against Oracle using SQL Developer that works in Web Intelligence. According to this BusinessObjects makes a call to set the date format.
So you can do that either in the preferences of SQL Developer (or presumably whatever database query tool you are using) or explicitly setting it with the alter session command.
alter session set nls_date_format = 'DD-MM-YYYY HH24:MI:SS';
select...[the rest of your query]
Both options are shown in the answer to How can I set a custom date time format in Oracle SQL Developer?.
I'm new to VB.NET programming, so pointing to examples is greatly appreciated.
I've got a OleDB connection to an Oracle 11g database. I'm reading a single row from a table and trying to populate a row object (mClockInOutInfo). The problem I'm running into is that there is a null DateTime (timestamp) column in the returned row.
Of course, I started with the mClockInOutInfo.RowDate = dr.GetDateTime(0) (assume the RowDate column is the first column in the query).
I quickly found out that nulls should be checked, so I added the = If(IsDBNull(dr.GetDateTime(0)), DBNull.value, dr.getDateTime(0)) to the code. (I now use the NullSafeString functions found around here somewhere. But there was nothing for DateTime types. I tried to make one, no success. So I'm still with the If(IsDbNull(...)) code for my datetime columns.
The problem I'm having is that I get the error: "Specified cast is not valid." when evaluating that statement. I've verified the column type with the .GetDataTypeName(0) method. It returns DBTYPE_DBTIMESTAMP. I've reviewed the schema information to verify that the column is actually the information I'm looking for. From what I can tell, the error is being generated while evaluating the IsDBNull(drRecent.GetDateTime(0)) portion of the if() statement. I've confirmed this by breaking the statement into a multi-line if statement:
if IsDBNull(dr.GetDateTime(0)) Then
...
Else
...
End If
I get the same cast error thrown by the if IsDBNull(...) line.
So, I went back to the SQL string and did a Coalesce on the column with the empty data in it. I received the same cast error. Finally, frustrated, I changed the sql query to use the TO_DATE function and fed in a date string with the appropriate format parameter. I STILL receive this same cast error.
The property in the mClockInOutInfo is defined as DateTime. There are other columns defined exactly the same way and those that have data in the table are not giving any errors.
Any ideas of what I should be doing when the database allows nulls in a DateTime (Timestamp) column? All ideas welcomed. Thank you in advance.
First it is important to note that this error is occuring while importing a set of data using the OracleBulkCopy object in a WPF application with the data stored in a DataTable object.
In this table there is one column which is of type "Date" (oracle) and the corresponding type is DateTime? (nullable) in the WPF application. However when setting up the DataTable for the OracleBulkCopy object I'm setting the data type of that column to DateTime (non-nullable) as nullable types are not permitted in the DataTable's DataColumn objects.
What is happeneing is that the data import works fine when all date values are null but as soon as I try an import with any actual dates I'm getting the error "Not a valid month" from the Oracle server. Normally when something like this happens you can use "to_date" to specify how the date is supposed to be interpreted.
Using OracleBulkCopy this is not possible and should also not be necessary as the dates aren't strings but actual DateTime objects.
I have also tried using the data type Oracle.DataAccess.Types.OracleDate but this had the same result.
I have not been able to find any solution to this so any help would be appreciated.
I've tried to do that.
HasManyToMany<YechidotDoarInGroup>(x => x.Col_yig)
.Table("PigToYig")
.ChildKeyColumn("YIG_GROUP_RECID")
.ParentKeyColumn("PIG_GROUP_RECID");
but I've got:
ORA-00942: table or view does not exist
I am trying to establish HasManyToMany connection not by ID , but by
some other property .
First I've got - too long message. When I've tried to enter my own Table name as an alias , it's not recognized. What should I do?
The problem may well be this:
.Table("PigToYig")
Oracle object names are, by default, in UPPER case. However, Oracle applies names in double-quotes in the given case. In other words, if your table has the default naming you may need to pass in this instead ...
.Table("PIGTOYIG")
It depends how NHibernate converts those variables into SQL (I'm not familiar with NHibernate).
Define Table() method before all of your mapping declaration.
public EmployeeMap : ClassMap<Employee>
{
public EmployeeMap()
{
Table("EMPLOYEE");
// your declaration
Id(x => x.IdEmployee);
}
}
Cause: The table or view entered does
not exist, a synonym that is not
allowed here was used, or a view was
referenced where a table is required.
Existing user tables and views can be
listed by querying the data
dictionary. Certain privileges may be
required to access the table. If an
application returned this message, the
table the application tried to access
does not exist in the database, or the
application does not have access to
it.
Action:
Check each of the following:
* the spelling of the table or view name.
* that a view is not specified where a table is required.
* that an existing table or view name exists.
source ora-code.com