Error in result of To_Char function.
Hi,
My name is Ramanujulu, I was practicing Date functions and found one error in one of the To_Char functions.
Please assume the sysdate as 19th Decmber 2006. (I used this date in example)
SQL> select to_char(sysdate-7, 'ddspth-month-syear') from dual;
TO_CHAR(SYSDATE-7,'DDSPTH-MONTH-SYEAR')
twelfth-december - two thousand six
It returns the 12th as twelfth. (Additional letter F). Who will correct this and how do i make this change in my Database.
Please let me know how to correct this.
Thanks,
Ramanujulu B.
http://dictionary.reference.com/browse/twelfth
Similar Messages
-
Unusual result with TO_CHAR function on a date
Can anybody explain to me why I see two different results if I use the following SQL in PL/SQL Developer (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)? I'm not sure if I have a wrong setting in Oracle or PL/SQL Developer, or if I'm just misunderstanding how the TO_CHAR function works. Many thanks.
select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
Results:
SYSDATE
10/02/2009 16:52:32
FORMATTED_DATE
10/02/2009 04:02:32select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
Results:
SYSDATE
10/02/2009 16:52:32
FORMATTED_DATE
10/02/2009 04:02:32It should not be -> mm it should be mi .
Got me?
Regards.
Satyaki De. -
Reg: error while converting a date datatype to the char using TO_CHAR function.
Hello all,
I'm trying to convert a date datatype to the specified format (i.e., by using vaariable using the to_char function in my sql,
SQL:
select 0 dummy,'select' from dual
union all
select a.COLUMN_ID dummy,
(case a.DATA_TYPE when 'NUMBER' then '''''' || '||' || a.COLUMN_NAME || '||'',''||'
when 'DATE' then '''"''' || '||' || TO_CHAR(a.COLUMN_NAME,'&dateformat') || '||' || '''",''' || '||'
else '''"''' || '||' || a.COLUMN_NAME || '||' || '''",''' || '||'
end)
from DBA_TAB_COLUMNS a
where a.OWNER = upper('&owner_name')
and a.TABLE_NAME = upper('&table_name')
union all
select 998 dummy,''' ''' from dual
union all
select 999 dummy,'from &owner_name..&table_name;' from dual
order by dummy
error:
when 'DATE' then '''"''' || '||' || TO_CHAR(a.COLUMN_NAME,'DD-MM-YYYY') || '||' || '''",''' || '||'
ERROR at line 5:
ORA-01722: invalid number
Please help me in resolving this, Thanks in advance.
Regards,
Konda.> ISA Server is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. (12204)
This seems to be your specific network configuration. It seems that your corporate network is blocking HTTPS requests which don't use port 443. Your ABAP system is configured to use a port other than 443. Either talk to your basis admins about changing your ABAP system configuration to use port 443 or talk to your network administrators to allow whichever port the ABAP system is running on. -
Need help in to_char function
Hi All,
I'm using below sql query to get sysdate with time stamp.
select to_char(sysdate,'YYYYMMDD HH24:MM:SS') from dual
This gives me below result: 20130816 05:08:49
Strangely, when I keep on running the same query, I notice after 60 seconds are complete, time stamp starts with 20130816 05:08:01 again.
Am i missing something here..
Thanks in advanceKarthick_Arp wrote:
Keep a simple thing in mind. Date stored in the DB does not have any format. Format need to be applied while you display. The default date format is specified by the NLS_DATE_FORMAT parameter. You have used TO_CHAR to display date in a specific format. But the problem is that you have converted DATE into string. So if its just for display purpose then set the NLS_DATE_FORMAT, do not use TO_CHAR.
With respect to your issue You need to represent Minute as MI. You have represented it as MM (Month) That's why you see 08 always.
" the problem is that you have converted DATE into string"
No, the problem was that he was explicitly using an incorrect format mask, specifying months where he should have specified minutes.
The problem inherently cannot be the result of converting a DATE into a string. Dates are always converted to strings for presentation, either implicitly by using the controlling setting of NLS_DATE_FORMAT (which can be set at several levels) or explicitly by using the to_char function. Oracle will always convert. It has to. Internally, a date is binary gibberish. But computer screens and printers can only show strings of characters, so the DATE will be converted to a character string, by hook or by crook. And the method of oracle making that conversion is exactly the same. The only thing that varies is how the user chooses to make that specification. And "not choosing" (by not using the to_char function) is still choosing ... choosing to rely on nls_date_format. -
Hi All,
I have run this query in my oracle database
SELECT
J.NAME,
(CASE J.STATUS WHEN 'Completed' THEN COUNT(J.STATUS) ELSE 0 END) CURRENT_MONTH_COMPLETE,
(CASE J.STATUS WHEN 'Pending for Process Engine' THEN COUNT(J.STATUS) ELSE 0 END) CURRENT_MONTH_IN_PROGRESS
FROM
CMN_SCH_JOBS_V J
WHERE
J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
and to_char(J.START_DATE,MM')=12
GROUP BY J.NAME,J.STATUS;I have a doubt regarding this
to_char(J.START_DATE,MM')=12Basically to_char() function returns a string value, but when it is equated against a numeric value oracle should raise an error right, this query is running fine. Please tell why this is happening.
Regards
Praveen VuppalapatiWhat a strange query. I'd expect it to be either:
SELECT
J.NAME,
J.STATUS
COUNT(*)
FROM
CMN_SCH_JOBS_V J
WHERE
J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
and to_char(J.START_DATE,MM')=12
GROUP BY J.NAME,J.STATUS;... or ...
SELECT
J.NAME,
SUM(CASE J.STATUS WHEN 'Completed' THEN 1 ELSE 0 END) CURRENT_MONTH_COMPLETE,
SUM(CASE J.STATUS WHEN 'Pending for Process Engine' THEN 1 ELSE 0 END) CURRENT_MONTH_IN_PROGRESS
FROM
CMN_SCH_JOBS_V J
WHERE
J.STATUS IN ('Completed','Pending for Process Engine') AND J.LANGUAGE_CODE='en'
and to_char(J.START_DATE,'MM')=12
GROUP BY J.NAME;Ought to wrap the to_char() in a to_number as well, really. -
Using the result of a function, inside a subselect
Hi!
I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
select * from t_node where node_pk in (get_node_parents_pk(22345));
The function get_node_parents_pk stands in for the following SELECT-statment:
select node_pk from t_node_child where parent_node_pk = 12345
The statement above would return something like this: 12435,23423,23453,23452
These values represent the node_pk value for the parent nodes.
I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
Any clue? =)I created a collection type in the database:
CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
SELECT *
FROM t_node
WHERE node_pk IN
(SELECT * FROM TABLE (get_node_parents_pk (22345)));
ORA-22905: cannot access rows from a non-nested table item
However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
SELECT *
FROM t_node
WHERE node_pk IN
(SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
SELECT *
FROM t_node
WHERE node_pk IN (get_node_parents_pk (22345));
Your reply is much appreciated!
Kind regards
Robert -
Error: [msnodesql] Invalid passed to function query
i create a schedule.
I try to run this code:
var todoItemtable = tables.getTable('TodoItem');
var item = {text:"blahblah"};
todoItemtable .insert(item, {
success: function() {
console.log('Inserted event: ', item);
or this:
var sql = "select * from TodoItem";
mssql.query(sql, {
success: function(results) {
console.log('Success: ', results);
}, error: function(err) {
console.log('Error: ', err);
but always get an error: [msnodesql] Invalid passed to function query. Type should be .
What is the problem? What am I doing wrong?Mal,
I think that need to provide more information about what you are doing when you get this error. This appears to be a LV error.
1)What version of LV are you using? What are you doing in TestStand when you get this error?
2)Is your TestStand sequence calling a VI from which this error is generated? If so what is this VI doing?
3)Can you isolate the source of this error to a particular VI that is using queues?
4)How often does the error occur?
5)The path of Queue Core.vi is \vi.lib\Platform\synch.llb\Queue Core.vi. Can you put some probes on the input of this VI to determine what inputs are causing this error? What are all of the inputs to this VI when the error occurs?
6)Is queue being created or destroyed? Is an element being added or removed from a que
ue?
7)Is this your queue or a queue used by one of LV's VIs?
Unless someone has had this exact error, then it is going to be difficult to debug without more information. Clearly, the problem is easiest to solve if it is reproducible by others. -
Trouble getting a timestamp formatted by a 'to_char' function
We have trouble getting a timestamp formatted by a 'to_char' function and a 'group by'
for a count. By assigning the result of the to_char function to an attribute and
grouping on that attribute, we try to get the frequency of an event.
What happens is a non predictable 'IllegalArgumentException' on
'Timestamp.class' while getting the timestampvalue.
We make use of a scrollablecursor as you can see in the stacktrace.
java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
at java.sql.Timestamp.valueOf(Timestamp.java:160)
at oracle.sql.CHAR.timestampValue(CHAR.java:567)
at oracle.jdbc.driver.ScrollableResultSet.getTimestamp(ScrollableResultSet.java:658)
at oracle.toplink.oraclespecific.Oracle9Platform.getObjectFromResultSet(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.getObject(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.fetchRow(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.cursorRetrieveNextRow(Unknown Source)
at oracle.toplink.queryframework.ScrollableCursor.retrieveNextObject(ScrollableCursor.java:512)
at oracle.toplink.queryframework.ScrollableCursor.loadNext(ScrollableCursor.java:357)
at oracle.toplink.queryframework.ScrollableCursor.hasNext(ScrollableCursor.java:233)
After restarting the application server there is a chance that the query returns
with the expected results. But most of the times it just returns the above
mentioned exception.
I don't see the logic in the apparently random parsing of the value.
The column in the database is a timestamp, but that the reason why i'm using the
to_char method.This is a bug in TopLink with ReportQuery. Please report this is Oracle technical support. Basically TopLink is converting to the attribute type, but should not be if a function was applied to the expression.
To workaround the issue you can use getField(/) in the expression instead of get(/) (using the database field name instead of the class attribute name). -
TO_CHAR Function Format Argument Limit
I was curious if there is a limitation to the length of the string used as the Format argument in the TO_CHAR Function? If so, how long is it?
I couldn't find it in the documentation, but it appears at first glance to be 63 for numbers with a simple format mask. You could experiment with the others:-
SQL>
SQL> DECLARE
2 v1 VARCHAR2(32767);
3 v2 VARCHAR2(32767);
4 BEGIN
5 FOR i IN 1 .. 32767 LOOP
6 BEGIN
7 v1 := v1 || '9';
8 SELECT TO_CHAR(1,v1) INTO v2 FROM dual;
9 EXCEPTION
10 WHEN OTHERS THEN
11 DBMS_OUTPUT.PUT_LINE(
12 'Maximum length of format mask for ' ||
13 'numbers is [' || TO_CHAR(i-1) || ']'
14 );
15 RETURN;
16 END;
17 END LOOP;
18 END;
19 /
Maximum length of format mask for numbers is [63]
PL/SQL procedure successfully completed.
SQL> SELECT TO_CHAR(1, '99999999999999999999999999999999999999999999999999999999999999') as sixty_two
2 FROM dual;
SIXTY_TWO
1
SQL> SELECT TO_CHAR(1, '999999999999999999999999999999999999999999999999999999999999999') as sixty_three FROM dual
2 /
SIXTY_THREE
1
SQL> SELECT TO_CHAR(1, '9999999999999999999999999999999999999999999999999999999999999999') as sixty_four FROM dual
2 /
SELECT TO_CHAR(1, '9999999999999999999999999999999999999999999999999999999999999999') as sixty_four FROM dual
ERROR at line 1:
ORA-01481: invalid number format modelRegards
Adrian -
Error While including the Multisite functionality
Error While including the Multisite functionality & trying to click on SiteAdministraion tab in BCC
Background: We have migrated our application from ATG v9.1 to ATG v 10.0.2 and implementing Multisite on the same
Getting this error on BCC console:
12:55:36,893 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.GA (build: SVNTag=JBPAPP_5_0_0_GA date=200910202128)] Started in 2m:44s:727ms
12:57:24,234 ERROR [SiteAdminActivitySource] The acl for the custom workflow activity named siteadmin.manageSiteAssets is invalid. This activity will not be available.
atg.security.InvalidPersonaException: Profile$role$siteAdminUser
at atg.security.AccessControlListParser.setPersona(AccessControlListParser.java:239)
at atg.security.AccessControlListParser.parseAce(AccessControlListParser.java:277)
at atg.security.AccessControlListParser.parse(AccessControlListParser.java:193)
Thanks in Anticipation1Hello Sudheer,
Increasing the Swap space is the only thing i noticed in all SAP Notes for your problem.
Configure more swapspace please and restart the installation.
Regards,
Siddhesh -
Error message in compliing a function
Hi All,
I am trying to compiling the following function, but it is throwing the an error.
CREATE OR REPLACE FUNCTION parapage_discosessions
RETURN bumber
IS
discosessions number;
BEGIN
discosessions := select count(*) from gv$session where username IN ('DISCOFIELD', 'DISCOUSER','DISCOADMIN');
RETURN discosessions;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
The above function is giving the following error message
Error(9,21): PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternatively-quo
Please give me any suggestionsSQL> CREATE OR REPLACE FUNCTION parapage_discosessions
2 RETURN number IS
3 discosessions number;
4 BEGIN
5 select count(*) into discosessions
6 from gv$session
7 where username IN ('DISCOFIELD', 'DISCOUSER','DISCOADMIN');
8 RETURN discosessions;
9 EXCEPTION
10 WHEN OTHERS THEN
11 raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
12 END;
13 /
Function created -
Error while determining the form function module
Hi everyone,
We are experiencing problems while displaying one adobe form in ESS. Its the Travel Expense form (PTRV_EXPENSE_FORM). When pressing the button to Display/Print the form we get an error message: "Error while determining the form function module", and no form I shown. The ADS server is configured correctly and there are other forms that are actually working, for example the Travel Request form. We are running WAS 7.0 with SP12.
Anyone has an idea what can cause the problem? Any help is greatly appreciated.
Thanks in advance!
Regards,
SophieViktor,
Thank you for your answer, it solved our problem!
Regards,
Sophie -
Error in import/export of functions - for the apex team
After exporting functions, the import gives an error.
Reason :
the export generates a script with
function \
function
importing this script gives an error because only the first function is imported. or the functions seems to be togheter one function
the export should generate
function
function
LeoLeo - I logged into your workspace and exported the functions. The generated script looks perfectly good. I then uploaded that file into my own workspace and ran the script. The functions were all created as separate functions.
There must be something happening at your end causing newline characters in the file to be lost or something. Or maybe I didn't follow exactly the steps you did.
BTW, when you mentioned the "\" character in your original post, I assumed you meant the "/" character.
Scott -
Error when calling a package function
any insight why my object is erroring out when calling a function. the error is
oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 1
it errors out when the cs.execute() is . is it the placement ? thanks for the help....
then pkg func is xxx.get_log
Get_Log(rmode IN NUMBER , doc_type IN VARCHAR2 DEFAULT 'TEL', doc_id IN VARCHAR2 DEFAULT NULL,
doc_num IN VARCHAR2 DEFAULT NULL -- , p_out out varchar2 --
RETURN varchar2 IS....
the co
Serializable paramDocLocatorParamList [] = {paramRMODE, paramDOC_TYPE, paramDOC_ID, paramDOC_NUM, p_out };
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OADBTransaction dbtrans;
OAViewObject docLocator = (OAViewObject)am.findViewObject("DocLocatorVO1");
rtxt0.setValue(pageContext, "here it is" + am.invokeMethod("getHTMLString", paramDocLocatorParamList));
docLocator.executeQuery();
// am.invokeMethod("getHTMLString", paramDocLocatorParamList);
the impl
public String getHTMLString ( String paramRMODE, String paramDOC_TYPE, String paramDOC_ID, String paramDOC_NUM, String p_out )
System.out.println("Entering The AM Impl");
CallableStatement st = null;
OADBTransaction txn = (OADBTransaction)getDBTransaction();
Connection conn = txn.getJdbcConnection();
String sql = " BEGIN :5 := test_proc.get_log(:1, :2, :3, :4 ); END; ";
CallableStatement cs = txn.createCallableStatement(sql,1);
String ErrorExist = "";
String getHTML = "";
try
cs.setString(1, paramRMODE);
cs.setString(2, paramDOC_TYPE);
cs.setString(3, paramDOC_ID);
cs.setString(4, paramDOC_NUM);
cs.setString(5,p_out); // --param
/* cs.registerOutParameter(1,Types.CHAR);
cs.registerOutParameter(2,Types.CHAR);
cs.registerOutParameter(3,Types.CHAR);
cs.registerOutParameter(4,Types.CHAR);*/
cs.registerOutParameter(5,Types.CHAR);
cs.execute();
getHTML = cs.getString(5 ) ;
/* System.out.println("getHTML is " + getHTML );
cs.close();
// if ( "E".equals(ErrorExist))
/// throw new OAException ("Payment Request Is Already Cancelled" );
catch (SQLException sqle)
try { cs.close(); }
catch (Exception e) {}
throw OAException.wrapperException(sqle);
String doctype = paramDOC_TYPE;
String docnum = paramDOC_NUM;
String html ;
System.out.println( "paramDOC_TYPE in IMPL is " + doctype) ;
System.out.println( "paramDOC_Numb in IMPL is " + docnum) ;
return getHTML;resolved.....
public String getHTMLString (String p_out , String rmode, String doc_type, String doc_id, String doc_num )
System.out.println("");
System.out.println("Entering The AM Impl");
// System.out.println("Passing getDocAbbrForHTML in IMPL -------> " +getDocAbbrForHTML );
// System.out.println("Passing paramDOC_NUM in IMPL -------> " + paramDOC_NUM );
System.out.println("Passing getDocAbbrForHTML in IMPL -------> " +doc_type );
System.out.println("Passing paramDOC_NUM in IMPL -------> " + doc_num );
CallableStatement st = null;
OADBTransaction txn = (OADBTransaction)getDBTransaction();
Connection conn = txn.getJdbcConnection();
String sql = " BEGIN :1 := test_proc.get_log(:2, :3, :43, :5 ); END; ";
CallableStatement cs = txn.createCallableStatement(sql,1);
String ErrorExist = "";
String getHTML = "";
try
cs.setString(2, rmode);
cs.setString(3, doc_type);
cs.setString(4, doc_id);
cs.setString(5, doc_num);
cs.registerOutParameter(1,Types.VARCHAR);
cs.execute();
getHTML = cs.getString(1 ) ; -
Error while Testing the Inbound Function Module
Hi,
I have created a Z Function Module (Posting Program) for Testing the EDI Shipment Tender Status. When I try to process the IDoc with the Transaction WE19 and when I enter the name of the Z function Module , it gives me an error saying that "Interface for Function Zxxxx is incorrect". Can somebody give me a solution for this? Answer would attract reward points.
Thanks,
Venkat.Hi,
You need to register this Function Module against Message Type.
Transaction code is : WE57.
Nilesh
Maybe you are looking for
-
Please help. I have been using itunes with my ipod nano for years. Several months ago I did a requested upgrade and have not been able to open itunes since. I get an error message that says that itunes was not installed correctly. Error 7 (Windows er
-
Project stops at a certain frame
I have been scanning these forums and I have not come across a fix for the problem I am having. Also, please keep in mind I am somewhat of a AE Novice, so if the fix is simple don't blame me for not finding it Basically, I am trying to render a loopi
-
6280, Not being recognised by PC Suite in Default ...
Using the latest service pack of XP, the latest build of Nokia's PC Suite and the CA-53 USB Connector Cable for my 6280 I am trying to connect to my PC. Its not being picked up by the suite. The computer recognises the phone. Ive reinstalled the conn
-
I haven't been able to use a few of my apps for a few weeks. I initially thought it was just a server issue. However, my friends are able to use the same ones. I have a 2nd generation Ipod Touch. I know its old lol! I specifically haven't been ab
-
On my iPad mini, it shows that there is 958 KB of data on my photo stream it yet I've never used it. Is there anyway I can delete that data off my iPad mini?