I'm using jaspersoft server to print some pdf files.
The server is connected to an Oracle Database through oracle.jdbc.OracleDriver.
It's configured as follows :
The server is working nicely. However when running a report that has a query like :
select to_char('Month', sysdate) from dual;
The result is always in english.
Is it possible to change Jaspersoft server connection to Oracle and make it work in another language ?
Thanks.
Regards,
SELECT statement you posted is invalid. It won't work at all:
SQL> select to_char('Month', sysdate) from dual;
select to_char('Month', sysdate) from dual
*
ERROR at line 1:
ORA-01722: invalid number
When fixed:
SQL> select to_char(sysdate, 'Month') from dual;
TO_CHAR(
--------
Studeni
How to use another language (as result I previously got is in Croatian; let's try English):
SQL> select to_char(sysdate, 'Month', 'nls_date_language = english') from dual;
TO_CHAR(S
---------
November
SQL>
Related
Can anyone explain the full form of "ddsp" in oracle sql command?
It is a spelled number.
SQL> select sysdate,
2 to_char(sysdate, 'ddsp') ex1
3 from dual;
SYSDATE EX1
-------- ------------
27.02.20 twenty-seven
SQL>
More info in any Oracle documentation, e.g. DATE_FORMAT
Need to know following points:
Where to locate Scheduled jobs in Oracle SQL Developer?
How to remove default date format from SQL Developer.
Jobs can be found within the "Scheduler" node through the "Connections" tab (note: the "Scheduler" node is not provided within the "Schema Browser" tab):
Alternatively, query
select * from user_scheduler_jobs;
select * from user_jobs;
for jobs created with DBMS_SCHEDULER or DBMS_JOB, respectively.
Date format can be set in "Tools" - "Preference"s menu, under the "Database" node, NLS settings.
[EDIT]
If you want to specify format every time, you can do that in both TO_CHAR and TO_DATE functions (depending on what you're doing). Here are a few examples:
SQL> select to_char(sysdate, 'dd.mm.yyyy hh24:mi') one_date,
2 to_char(date '2019-08-25', 'mon, dd yyyy') two_date,
3 to_date('12-18-2018 13:22', 'mm-dd-yyyy hh24:mi') three_date
4 from dual;
ONE_DATE TWO_DATE THREE_DATE
---------------- ------------ -------------------
08.03.2019 13:15 kol, 25 2019 18.12.2018 13:22:00
SQL>
I found good results from this query, select * from dba_scheduler_jobs;
Does anyone know why the first query would be causing this error to be thrown while the second one works?
ORA-01882: timezone region not found 01882. 00000 - "timezone region %s not found"
Causes Error: SELECT SYSTIMESTAMP AT TIME ZONE (SELECT t.TIME_ZONE FROM SOME_TABLE t WHERE t.TIME_ZONE = 'America/Denver' AND ROWNUM = 1)
FROM DUAL
Works Correctly: SELECT SYSTIMESTAMP AT TIME ZONE (SELECT 'America/Denver' FROM SOME_TABLE t WHERE ROWNUM = 1)
FROM DUAL
Note: This is running on a Oracle Database 11g Release 11.2.0.4.0 - 64bit db. I've verified both queries work correctly on another db with the same db version. Not sure what else could be causing this.
To summarize the root cause, it was related to t.TIME_ZONE's data type (which was NVARCHAR2). Here's an example showing that NVARCHAR2 time zone names are not supported in 11g:
Does not work: SELECT SYSTIMESTAMP AT TIME ZONE CAST( 'America/Denver' as NVARCHAR2(80)) FROM DUAL
Works: SELECT SYSTIMESTAMP AT TIME ZONE CAST( 'America/Denver' as VARCHAR2(80)) FROM DUAL
Wrapping t.TIME_ZONE in TO_CHAR() fixed the problem.
How should I write the following select in delphi:
select to_char(sysdate, 'dd.mm.yyyy hh:mm:ss) from dual
When I try to execute it I receive an error, but this works:
select to_char(sysdate) from dual
Thanks in advance!
Missing single quote possibly at the end of your format string?
*
select to_char(sysdate, 'dd.mm.yyyy hh:mm:ss') from dual
*
You might try going in to SQL*Plus and running the query that works so you can see what format Delphi seems to want.
Share and enjoy.
I need to select some values from an Informix database via Oracle ODBC. One of the columns is a timestamp, and when I just select it all I see in SQL*Plus is the date value. How do I get the time as well?
By default SQL*Plus will display the date in the format specified by the NLS_DATE_FORMAT system parameter (client side). You can alter this behaviour by setting the NLS_DATE_FORMAT appropriately. You can also explicitly display the time data:
SQL> select sysdate from dual;
SYSDATE
-----------
05/10/2009
SQL> select to_char(sysdate, 'hh24:mi') from dual;
TO_CHAR(SYSDATE,'HH24:MI')
--------------------------
13:55