It_field1 must be character type field
hai all,
I was facing the following error:
there is a macro called wdr_file_export 1 'ASC' p_report.
In this it is giving an error that
"IT_FILE1" must be a character-type field (data type C, N, D, or T).
But I was not able to find the object it_file1.
I tried to create a new object of the same name it says that the object already exists.
now I was unable resolve this error .
can anybody pls help me.
thanks in advance,
sri.
hi ,
first get the structure of the itab u r using .
declare like this ..
data : begin of itab occurs 0.
include structure <structure name>.
data: end of itab.
regards,
venkat.
Similar Messages
-
Unicode - "DMBTR" must be a character-type field (data type C,N,D or T)
Greetings Experts!
I am trying to convert legacy code to Unicode for a current ERP6.0 reinstallation and have encountered the syntax error "DMBTR" must be a character-type field (data type C,N,D or T)
The field is part of a structure and the fields attributes are as follows:
COMPONENT = DMBTR
COMPONENT TYPE = DMBTR
DATA TYPE = CURR
LENGTH = 13
DECIMALS = 2
DESCRIPTION = Amount in Local Currency
The code in question is as follows:-
macro Move_Zoned.
Converts a numeric variable to zoned format and moves it to a
target variable.
DEFINE move_zoned.
&1 - source variable
&2 - Number of Decimal Places
&3 - 'To'
&4 - Target Variable.
write &1 to w_zoned no-grouping decimals &2.
condense w_zoned.
Remove the Decimal Points.
search w_zoned for '...'.
while sy-subrc = 0.
move sy-fdpos to w_to_point.
if w_to_point = 0.
w_to_point = 1.
endif.
compute w_from_point = sy-fdpos + 1.
concatenate w_zoned+0(w_to_point)
w_zoned+w_from_point
into w_zoned.
search w_zoned for '...'.
endwhile.
shift w_zoned right deleting trailing space.
translate w_zoned using ' 0'.
call function 'Z_TRANSLATE_ZONED_DECIMALS'
exporting
i_input = w_zoned
importing
i_output = w_zoned
exceptions
x_invalid_zoned_char = c_invalid_zoned_char
x_numeric_info_lost = c_numeric_info_lost
others = c_other_zoned_error.
Get the length of the recipient field so we don't truncate the
numbers....
describe field &4 length w_flength in character mode.
describe field &4 type w_type.
describe field w_zoned length w_zoned_len in character mode.
if w_zoned_len <= w_flength.
move w_zoned to &4.
shift &4 right deleting trailing space.
translate &4 using ' 0'.
else.
Get the start position....
If it's a packed field allow for values up to 6 figures
compute w_zoned_len = w_zoned_len - w_flength.
if w_type = 'P'.
subtract 2 from w_zoned_len.
clear w_type.
endif.
move w_zoned+w_zoned_len &3 &4.
endif.
END-OF-DEFINITION. "Move_zoned
LOOP AT t_single_kunnr.
move_zoned t_single_kunnr-postamt 2
to t_single_kunnr-dmbtr.
DIVIDE t_single_kunnr-dmbtr BY 100.
MODIFY t_single_kunnr.
ENDLOOP.
Is there a solution to get past this syntax error as I would rather not change the datatype of the field in the structure.
Much Obliged
Elphick.Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
Comparision of character type field
hello expert,
i want to compare a character type field without using operator like ge, ne etc.
plz help me if you know.
thanks in advanceHi,
If it is character type. it will compare like this
For operands with a character-type data type (c, d, n, t, string) the contents are compared from left to right. Based on the order in the code page used, the first different character from the left decides which operand is larger.
let try this example you will get wrong output
data : lv_field1 type char2 value '2',
lv_field2 type char2 value '12'.
if lv_field1 GT lv_field2.
write : / 'test'.
endif.
So assing the values to some integer varaibles and compare then it will work fine.
Hope it will helps -
Problem with select range for a character type field. Kindly Help! Urgent!
Hi Experts,
I have to write a report to pull data from a table BUT000 for a selected range of BPEXT field values in selection screen.
In the table BUT000, the BPEXT field is type char. Now what is happening is that if the user gives a range in selection screen from 1000 to 1010 the query pulls all the records where teh forst character starts from 1.
For example if the table has
BPEXT
1
10
100
101
1000
1001
1002
1005
1010
20
200
2000
Then my query pulls
BPEXT
101
1000
1001
1002
1005
1010
Instead it should pull only
BPEXT
1000
1001
1002
1005
1010
My guess this is because the BPEXT field is of CHAR type instead of numeric.
What shall i do to solve this problem? Kindly help please!
Thanks
Gopal
Message was edited by:
gopalkrishna baligaHi Chakradhar,
How to find the conversion exit for BPEXT field?
How to use the conversion exit in a select query in my ABAP report? Any sample code will be really helpfull.
Please help!
Thanks
Gopal -
Select option for a character type field
Hi all as per my requirement i have a selection for a data type char40
Hence in my wddoinit method i used the following code to generate the select options in WD
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'CHAR40' ).
add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'CHAR40'
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY I_NO_INTERVALS = 'X').
The select option is properly displayed but "char" word is infront of the selection fields.
I want to remove this char word.
Can someone please advice me on this ?Hi
Modify the Add_selection_field call to add descrption for the field.
if you dont want anything pass space.
* add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(
I_ID = 'CHAR40'
IT_RESULT = LT_RANGE_TABLE
I_READ_ONLY = READ_ONLY
I_NO_INTERVALS = 'X'
I_DESCRIPTION = ' ' " whatever you pass here will come as a label to the field or we can say
" inplace of CHAR
thanks
sarbjeet singh -
Hi all,
I stored 'A' in a character field which is of lenght 1. How can it be incremented to B, C, D and so on. (Suppose in loop or so).
Regards,
Balakrishna.NUse Translate
CONSTANTS:
trn(52) VALUE 'ABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZA'.
DATA:
chrfld VALUE 'A'.
DO 26 TIMES.
WRITE:/ chrfld.
TRANSLATE chrfld USING trn.
WRITE AT 10 chrfld.
ENDDO. -
Can not converted to be a charter-type field
Hi everyone,
As i m new in abap . i wrote this code and received charter type error.
*& Report ZT11
REPORT ZT11.
DATA: aa type lfa1.
tables lfa1.
select * from lfa1 into aa where lifnr > 'Z' .
write / aa.
endselect.
if sy-subrc <> 0.
write / 'No records found'.
endif.
error is
'AA' can not converted to a character-type field.
plz help to reslove the error .
thanks in advance.
Edited by: Faisal Abbasi on May 9, 2010 11:19 AMHi Dear,
This is Unicode problem, In unicode systme some restriction in programing.
There is three kid of data type
Character Processing ( C, N, D, T and STRING ).
Byte Processing Mode ( X and XString ).
Numeric Data Type ( I, P , F ).
whenever in structure all kind of data types are used then you can not use WRITE and then whole structure name.
in LFA1 in ECC6.0 if any custom fields are not added then up to length 1232 is determined as Character.
so if you will give aa(1232) it will work similarlly other kid of remainig data tpe you move in another structure of required format and then check.
REPORT ZT11.
DATA: aa type lfa1.
tables lfa1.
select * from lfa1 into aa where lifnr > 'Z' .
write / aa(1232).
endselect.
if sy-subrc 0.
write / 'No records found'.
endif.
For better Understanding Check
The following structure has both character-type and non-character-type components:
BEGIN OF STRUC,
a TYPE c LENGTH 3, "Length 3 characters
b TYPE n LENGTH 4, "Length 4 characters
c TYPE d, "Length 8 characters
d TYPE t, "Length 6 characters
e TYPE f, "Length 8 bytes
f TYPE c LENGTH 28, "Length28 characters
g TYPE x LENGTH 2, "Length 2 bytes
END OF STRUC.
The Unicode fragment view splits the structure into four areas F1 - F5.
[ aaa | bbbb | cccccccc | ddd | AAA | eeee | fffffffffffff | gg ]
[ F1 | F2 | F3 | F4 | F5 ]
Offset/length access is only possible for the character-type initial fragment F1. Specifications such as struc(21) or struc7(14) are accepted and are handled as a single field of type c. An access such as struc57(2), for example, is not permitted in Unicode systems. -
Dynamic Data: Character Type Declaration
Hello Experts,
I would like to get your feedback regarding declaration of a character type field with dynamic length?
For example, I would like to declare data like: char(size) type c, where size is dynamic.
How can I do this? Thanks in advance.
Regards,
JeromeHi,
DATA r_elemdescr TYPE REF TO cl_abap_elemdescr.
r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( 'DATA_ELEMENT_HERE' ).
DATA r_field TYPE REF TO data.
FIELD-SYMBOLS <field> TYPE ANY.
CREATE DATA r_field TYPE HANDLE r_elemdescr.
ASSIGN r_field->* TO <field>.
<field> = .....
now <field> is your dynamic field value
Regards,
Ravi -
Hi All,
following piece of code was working fine in 4.6 C but in ECC 6.0 I get the following error:
" "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) . "
I tried type-casting with field symbols but still not able to remove the error. Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
In the following code :
DATA: DELIMITER TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
end_of_record TYPE x.
SPLIT data_file_i AT delimiter INTO it_ekko-rtype
it_ekko-ebeln
it_ekko-bsart
it_ekko-lifnr
it_ekko-bedat
it_ekko-ekorg
it_ekko-ekgrp
it_ekko-bukrs
it_ekko-zterm
it_ekko-zbd1t
it_ekko-zbd1p
it_ekko-zbd2t
it_ekko-zbd2p
it_ekko-zbd3t
it_ekko-inco1
it_ekko-inco2
it_ekko-waers
it_ekko-wkurs
it_ekko-kufix
it_ekko-verkf
it_ekko-telf1
it_ekko-ihrez
it_ekko-unsez
it_ekko-angnr
it_ekko-ihran
it_ekko-submi
it_ekko-loekz
end_of_record.
where all these fields except " end_of_record " are of character type and "data_file_i " is a character type structure as defined below:
DATA :
BEGIN OF data_file_i OCCURS 0,
record(1000),
END OF data_file_i,Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
Before Unicode
CONSTANTS: c_hex TYPE x VALUE '09'.
Resolution:
Itu2019s work for any value of x.
First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
Example:
CONSTANTS: c_hex TYPE x VALUE '09'.
DATA: LV_TEMP TYPE STRING.
DATA: LV_TMP TYPE C.
TRY.
CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
EXPORTING
UCCP = c_hex
RECEIVING
CHAR = LV_TMP .
CATCH CX_SY_CONVERSION_CODEPAGE.
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
ENDTRY.
CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG
I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
SEPARATED BY LV_TMP.
I_BUFFER = LV_TEMP.
CLEAR LV_TEMP.
CLEAR LV_TMP.
OR
Note: It works only for type x value 09.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: c_hex TYPE c VALUE
abap_char_utilities=>HORIZONTAL_TAB. -
While inserting numeric data into a character datatype field and vice versa
Sir,
I have a very basic qiestion.Why am i not getting any error while inserting to say employees table a character type data to a numeric type field and vice versa?Iam using Oracle Database 10g Enterprise edition.Why am i not getting any error while inserting to say employees table a character type data to a numeric type field and vice versa?
Oracle tries an automatic conversion, when possible. Post an example of a character type data inserted into a numeric column. -
Select query based on Simple Type field in JDT
Hello Experts,
We have a JDT table consisting of a field "CONSUMPTION_ID" which refers to a Simpletype.So at oracle level the datatype of the field shows as CLOB instead of String. I am unable to use this simple type field in the WHERE clause in my bean .
Following are the queries i have tried and the errors i have got executing them :
Query1 - SELECT * FROM TEST_TABLE WHERE CONSUMPTION_ID <> 'RT'
Error - com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM "TEST_TABLE " WHERE "REF_MAT_DOC_NO" = ? AND "REF_MAT_DOC_YEAR" = ? AND "CONSUMPTION_ID" <> 'RT'" contains the semantics error[s]: - 1:84 - type check error: the expression >>"CONSUMPTION_ID"<< (CLOB) is not comparable and must not be used with "<>"
- 1:84 - type check error: the left hand side >>"CONSUMPTION_ID"<< (CLOB) and the right hand side >>'RT'<< (CHAR) of a comparison operator are not comparable
Query 2 - SELECT * FROM TEST_TABLE WHERE to_char(CONSUMPTION_ID) <> 'RT'
Error - com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM TEST_TABLE WHERE REF_MAT_DOC_NO = ? AND REF_MAT_DOC_YEAR = ? AND to_char(CONSUMPTION_ID) <> 'RT'" contains the syntax error[s]: - 1:91 - SQL syntax error: the token "(" was not expected here
Please let me know if any one has used WHERE clause on fields which refer to a simpletype in JDT, or any other solution to the above problem
Regards,
ViragHello Experts,
We have a JDT table consisting of a field "CONSUMPTION_ID" which refers to a Simpletype.So at oracle level the datatype of the field shows as CLOB instead of String. I am unable to use this simple type field in the WHERE clause in my bean .
Following are the queries i have tried and the errors i have got executing them :
Query1 - SELECT * FROM TEST_TABLE WHERE CONSUMPTION_ID <> 'RT'
Error - com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM "TEST_TABLE " WHERE "REF_MAT_DOC_NO" = ? AND "REF_MAT_DOC_YEAR" = ? AND "CONSUMPTION_ID" <> 'RT'" contains the semantics error[s]: - 1:84 - type check error: the expression >>"CONSUMPTION_ID"<< (CLOB) is not comparable and must not be used with "<>"
- 1:84 - type check error: the left hand side >>"CONSUMPTION_ID"<< (CLOB) and the right hand side >>'RT'<< (CHAR) of a comparison operator are not comparable
Query 2 - SELECT * FROM TEST_TABLE WHERE to_char(CONSUMPTION_ID) <> 'RT'
Error - com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM TEST_TABLE WHERE REF_MAT_DOC_NO = ? AND REF_MAT_DOC_YEAR = ? AND to_char(CONSUMPTION_ID) <> 'RT'" contains the syntax error[s]: - 1:91 - SQL syntax error: the token "(" was not expected here
Please let me know if any one has used WHERE clause on fields which refer to a simpletype in JDT, or any other solution to the above problem
Regards,
Virag -
Database Type field in Data Services 3.0
Hi,
Now I'm using the IDSServer 4.5 JDBC-ODBC driver type 3 to connect BEA Acqualogic Data Services 3.0 to MS-Access 2003.
I configured the IDSWaldbottDS DataSource with those parameters:
Driver class name: ids.sql.IDSDriver
URL: jdbc:ids://psnb161:12/conn?dsn=WaldbottDS
I created the system DSN ODBC datasource called 'WaldbottDS' in Windows XP
Based on the AdminServer log file, I can demostrate that the BEA connect successfully with MS Access:
####<Mar 5, 2008 9:14:37 AM ACT> <Info> <JDBC> <psnb161> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1204726477248> <BEA-001516> <Connection Pool "IDSwaldbottDS" connected to Database: "ACCESS", Version: "04.00.0000".>
Now, In the project Explorer, I executed those commands:
New -> Physical Data Service.
Inside the Create Physical Data Service dialog box, the Relational database objects is set to Tables and views.
I select the Data Source Type as Relational. When I select IDSwaldbottDS as Data Source, nothing appears in "Database Type" field. If I press the next button, an error message appears:
"Cannot obtain connection: driverURL = jdbc:weblogic:pool:IDSwaldbottDS, props = {EmulateTwoPhaseCommit=false, connectionPoolID=IDSwaldbottDS, jdbcTxDataSource=true, LoggingLastResource=false, dataSourceName=IDSwaldbottDS}.
Nested Exception: java.lang.RuntimeException: Failed to Generate Wrapper Class
at weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.java:213)
at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactory.java:173)
at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:247)
at weblogic.jdbc.pool.Driver.connect(Driver.java:164)
at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:647)
at weblogic.jdbc.jts.Driver.connect(Driver.java:137)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:550)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:440)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:436)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:58)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:975)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
I recognize that the "Database Type" must be filled with the database version so I can continue configuring the physical Data Source for MS Access 2003.
How can I solve this problem?[ There original post I made is incorrect. The classes/shared libraries need only to be available to the server - they do not need to be available to ALDSP Studio, since the database is access via the server. Double check that the required classes/shared libraries for your jdbc driver are available to your server ]
I searched our CR database for the stacktrace/error that you have and found serveral CR. Most of them indicate the problem was jar file(s) for the jdbc driver were not present in the client classpath. So - whatever you added to the server classpath (and PATH - if there were also shared object libraries) - we need to add those to the ALDSP Studio (eclipse) classpath (PATH).
you can put the jar(s) in
aldsp_3.0\eclipse-plugins\dsp\eclipse\plugins\com.bea.dsp.ide.external_3.0.0
and modifying
aldsp_3.0\eclipse-plugins\dsp\eclipse\plugins\com.bea.dsp.ide.external_3.0.0\META-INF/manifest.mf.
There are two places in manifest.mf you will need to add the jar file - once under Bundle-Classpath and once under Export-Package.
Edited by mreiche at 03/07/2008 10:48 AM -
Abap dump: internal table too small, condense non-character like fields
Hi there,
I created a dynamic internal table by:
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
ASSIGN IT_EP_TABLE->* TO <IT_DBTABLE>.
SELECT * FROM (P_TABLE_NAME)
<b> INTO TABLE <IT_DBTABLE> </b>
It gave the error <b> internal table too small </b> SAPSQL_SELECT_TAB_TOO_SMALL,
so I removed the error by using "into corresponding fields of <IT_DBTABLE>.
But now it is not creating a TXT file by function module from internal table records. As it says the CONDENSE statement cannot be executed and dump occurs: 'OBJECTS_NOT_CHARLIKE' 'The current statement only supports character-type data objects', 'In statement
"CONDENSE" the argument "<F_SOURCE>" can only take a character-type data object'.
It only happens for table AFPO. As I think this table has fields i.e. currency which cannot be treated as characters. Is the move corresponding approach ok. Or how can I create text file with these records.try creating a dynamic table in the image of the source table and then move-corresponding to the original one. Something like this:
DATA dref TYPE REF TO data.
DATA tabdref TYPE REF TO data.
FIELD-SYMBOLS <dyn_struc> TYPE ANY.
FIELD-SYMBOLS <struc> TYPE ANY.
FIELD-SYMBOLS <tab> TYPE table.
*create table of your choice
CREATE DATA tabdref TYPE TABLE OF (P_TABLE_NAME).
ASSIGN tabdref->* TO <tab>.
create a line variable for the above table
CREATE DATA dref like line of <tab>.
ASSIGN dref->* TO <struc>.
create a line variable for the dynamically created table
CREATE DATA dref like line of <IT_DBTABLE>.
ASSIGN dref->* TO <dyn_struc>.
SELECT * FROM (P_TABLE_NAME)
INTO TABLE <tab>.
loop at <tab> assigning <struc>.
move-corresponding <tab> to <dyn_struc>.
append <dyn_struc> to <IT_DBTABLE>.
endloop. -
Value must be of type integer (between -2147483648 and 2147483647)
Hi,
Does anyone knows how to overcome this issue?
NW7.01.05
My Table in the View uses as dataSource a node called "DumpReport" - This has been created using a Structure type Zwd_S_Dumpage_Data.
The structure has some elements, and my issue is in the Quantity element. This element is defined as:
Element Name: Quantity
Simple Type Package: [irrelevant]
Simple Type: Zwd_E_Dumpqty
Built-in Type: decimal
Length: 13
Decimals: 3
I have one InputField, binding to this property. When I try to submit any decimal values, I get this error:
" Value must be of type integer (between -2147483648 and 2147483647) " - related to that Context Property (Quantity).
Regards,
DanielFor future reference,
External Length for this dataType was 17. We made it bigger in the R/3, since we compared to a Price field and it was 18 and working.
Somehow this fixed our issue. I'm still looking for some additional information, since the Built-in type was a Decimal (WDP side) and it was being validated as an Integer?!!?
Daniel -
How to Update Date data type field value in oracle
I want to update records in a table that has a Date data type field. It's a oracle databse. I use the oracle thin drive to connect to the database. The everything works well, only when i try to update records that have date type value, something doesn't work.
I use the following stmt to update DB:
Class.forName("oracle.jdbc.driver.OracleDriver");
Conn = DriverManager.getConnection("jdbc:oracle:thin:@hostname:portnumber:schname", "uid","pwd");
stmt=Conn.createStatement();
String updStr = "UPDATE Article SET Archive = ' Disable' WHERE ArticleDate = # " + sqlDate +"# " ;
stmt.executeUpdate( updAStr ) ;
But I always got the SQLException run time error, which is "ORA-00911: invalid character"
Who can help me to find out how to write the above Update statement correctly? esp. that how to present the Date type variable in the statement.!
BTW, sqlDate is a Java.sql.Date variable, Is it "# " + sqlDate + "# " the right way?
Many thanksWhat do you get out of Oracle's TO_DATE that java.sql.PreparedStatement.setDate()
won't give you? - MODWell, I don't know that I've used all capabilities of either, but when it comes to managing Date Strings my Oracle bias :) would be to code using Oracle's TO_CHAR and TO_DATE functions. Perhaps someone can tell me vendor neutral ways to do something simiilar to managing these input date/times (and hopefully just as easily, pretty much all done in a single line, single function)?
WHERE aDATE > TO_DATE('2010','YYYY')
WHERE aDATE > TO_DATE('2010 AUG 22','YYYY MMM DD')
WHERE aDATE > TO_DATE( 'January 15, 1989, 11:00 A.M.', 'Month dd, YYYY, HH:MI A.M.')
I believe most databases have something similar to this, although I have found Oracle's to be the most flexible and consistent, if not the most intuitive. Other vendors (DB2, SQL Server, Access) don't force you to always be explicit, and can accept a variety of date strings without masks. The problem is that while you might not be getting an error, it also may not be parsing your date as expected.
One could argue that this vendor specific hodgepodge of literal date/time strings is only one program modification away from disaster. They might be right.
Just to be clear. I'm not recommending using a vendor specific approach, but it's not a perfect world and somtimes you have to use what works easiest or best or fastest, and in some cases, that is the vendor specific alternatives.
Maybe you are looking for
-
Dynamic VLANs on a Catalyst 3560
Hello, I'm looking for a solution that would enable me to assign users to a specific VLAN based on MAC address. I'm using a Catalyst 3560 switch. Is there something similar to VMPS that would allow me to do this? I would like to run VMPS, but it look
-
Initializing Selection-Screen as dynpro subscreen
Hello! I wrote a dynpro program that includes a selection screen as subscreen. In the flow logic the subscreen is called before output like this. process before output. call subscreen sub including sy-repid '110'. module status_0100. The program
-
Lightroom's HTML gallery does not validate
Web gallery created by Lightroom 1.3.1: http://automagisk.no/ Validation at W3C fails: http://validator.w3.org/check?uri=http%3A%2F%2Fautomagisk.no%2F&charset=%28detect+automati cally%29&doctype=Inline&ss=1&group=0&verbose=1 The errors seem pretty st
-
In an existing HTML topic, I have a large 2 column table which contains the names of security profiles (left column) and descriptions (right column). Recently, our developers renamed some of the security profiles, so I updated the names in RoboHelp.
-
[SOLVED] custom repo e new pacman
I just updated pacman, and I noticed that when syncing the repos the progress bar for my local repo isn't displayed anymore as well as the "repo is up to date" message when no new version is detected. Anyway, the local repo is updated just fine, sinc