Filtering Fixed Length data type fields
Hello,
My application has filters on fixed length charcter(CHAR) columns. But the query do not return any data because of trailing blanks. I cannot use RTRIM function as there are many filters and modifying them will be a big project. So is there any SET variable that can be used to solve this problem?
EX: select * from emp where name = 'SMITH' do not return any data.
select * from emp where name = 'SMITH ' returns data.
Thanks for help.
So is there any SET variable that can be used to solve this problem?Nope. This is just one reason why CHAR dataypes are teh Suck and really ought to be avoiding.
The other problem with using TRIM() is that it will invalidate any indexes on those columns, so you need to build function-based indexes, which is a PITN. An alternative approach would be to
select * from emp where name = rpad('&ename', 15)
/but that would require you to go through all your queries and apply RPAD which would be an even bigger PITN.
I suppose a migration exercise to replace all your CHAR columns is out of the question????
Cheers, APC
Similar Messages
-
Insert current date and time into Oracle date type field
I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
Here is what I have for my JDBC inserts and I also tried something with DateFormat:
PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
I also tried:
PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.sportsMarkr wrote:
Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
[http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
If you want a date and time then use java.sql.Timestamp. -
To find the date type fields in the row and validate those date fields
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
MTART TYPE MARA-MTART,
END OF TY_MARA.
DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
it_mara1 TYPE STANDARD TABLE OF ty_mara,
wa_mara TYPE ty_mara.
loop at it_mara into wa_mara.
describe field wa_mara-ersda type c_data.
if c_data eq 'D'.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = wa_mara-ersda
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2
IF sy-subrc eq 0.
wa_mara-ersda = '00000000'.
append wa_mara to it_mara1.
write :wa_mara-matnr,wa_mara-ersda.
else.
wa_mara-ersda = '00000000'.
append wa_mara to it_mara1.
write :wa_mara-matnr,wa_mara-ersda.
ENDIF.
endif.
endloop.
This issue regarding how to find the date type fields in the row and validate those date fields.If its not a valid date ,i have to assign initial value to that.
I've tried that for single field using describe field.Please help me do that for all fields.Hi Sam,
I believe we had discussed the same issue in the below thread. Can you please refer the below one?
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d93e16ff-c123-4b36-b60b-60ccd34f6ca7/calculate-time-differences-in-infopath?forum=sharepointcustomizationprevious
If it's not helping you please let us know
Sekar - Our life is short, so help others to grow
Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
you see a reply being an answer to the question of the thread, click "Mark As Answer -
Can "SPML Web Service Complex Data Type field" take multiple values ?
In Generic Technology Connector's -SPML design parameters section, Can we give multiple values in SPML Web Service Complex Data Type field?
If not, how can i call methods directly instead of calling them through a values of the "name" attribute of the "complexType" element in SPML Web Service Complex Data Type?
I need 'SPML Web Service Complex Data Type' to hold multiple values.And based on the request it has to initiate appropriate method of action.
Presently i have three methods add,modify and delete which i am calling through a single value of the "name" attribute of the "complexType" element in SPML Web Service Complex Data Type.
I want to replace this single value with multiple menthods , so that a direct interaction between the method,OIM and target can be established.
Edited by: 821054 on 16/02/2011 04:23Thanks Robert.
You'll need to create your own interface to the webapp database for those kind of data operations
by this, are you speaking of the internal BC database which stores web app schema data? That would be great if it were possible to update that programmatically because I need to use the List (Checkbox List) field type (for the search functionality), but I need to supply the checkbox options from a web app rather than by manually updating the list entered in the Fields view of the web app settings (shown below).
I'm curious if anyone else has tried this?
Again, my reason for needing to use the List (Checkbox List) field type is that the page which processes searches knows to expect a comma separated list for this field type and then appears to be parsing out the individual values for searching out web app items with 1 or more matching values. You're right that text fields (string and multiline) just check for 'string contains' matches, and this would be ok if I was only ever needing to search just one value at a time. Here's an example of what I might do:
Web App item field value (as recorded against the List (Checkbox List) field type:
8294877,8294878
Web App Search value (for this same field):
8294879,8294877,8294885
The search would return this web app item because the field contains 2 (1 or more) individual values even though they were entered into the search field in a different order. If this web app item were just a Text (string or multiline) field, the searched value is not a substring of the web app item's stored value, so it would not find a match. Hence the need to use Checkbox List field type.
The web app will have thousands if not 10s of thousands of records, so dumping them all into one big array or object and searching on the front-end won't be practical (though it works great on smaller datasets). -
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. -
Infotype 0041 - Date type field in display mode always
Hi All,
Please help in find out solution for the below enhancement
In infotype 0041 we have date type and date field. We need to make the date type field to be display mode always.
Thanks for your help in advance.
Thanks,
KarthikeyanHi Karthikeyan ,
Please find the resolution as below :
Userexit - EXIT_SAPFP50M_001 . In Include ZXPADU01. Write the below code .
DATA: w_P0041 TYPE P0041.
IF ipsyst-massn <> space AND
( ipsyst-ioper = 'INS' OR
ipsyst-ioper = 'INSS' OR
ipsyst-ioper = 'COP' OR
ipsyst-ioper = 'MOD').
CASE innnn-infty.
WHEN '0041'.
*convert prelp to pnnnn structure
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
EXPORTING
PRELP = INNNN
IMPORTING
PNNNN = w_P0041 .
*Here you can have more conditions like for which Action Types you want the
IT0041 to default .
w_P0041-dar01 = 'Z1'.
w_P0041-dar02 = 'Z2'.
w_P0041-dar03 = 'Z3'.
*convert pnnnn to prelp structure
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>pnnnn_to_prelp
EXPORTING
PNNNN = w_P0041
IMPORTING
PRELP = INNNN.
*Display mode
LOOP AT SCREEN.
IF screen-name = 'P0041-DAR01' OR
screen-name = 'P0041-DAR02' OR
screen-name = 'P0041-DAR03' .
CLEAR screen-group2.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN OTHERS.
ENDCASE.
ENDIF.
Thanks ,
Sucharita Das -
Importing an SQL Server TEXT data type field in Oracle - problem with LONG
Hello,
I work in Oracle 9i and I created a view on a distant SQL Server database that contains a TEXT data type field. But I have a problem when I select that field in Oracle; I have the following error message: "ORA-00997: forbidden use of LONG data type".
Could anybody have a solution for me, to solve that problem?
Thanks a lot!It is very difficult to suggest anything without seeing your code. I don't even know if what you are seeing is the actual value or an error code. Often, negative numbers are indicative of error codes.
For instance -1 could mean that you have an invalid reference or path, etc...
Can you post your code? -
Want to Have INT4 Data type field in IT
Dear All,
I want INT4 Data type field in my Customized infotype field.
Is it possible to have it with signs.
Thanks
Satya.Hello Satya
you cant have INT4 as datatype in your custom infotype
Reward points if helpful -
Info on CCM 2.0 characteristics - Fields length, data types & Desc
Dear All,
Does anybody know how or where I can get information about CCM 2.0 standard characteristics data structure?
Or maybe the table name that holds this information?
I need the following info:
1. List of all Standard CCM 2.0 Characteristics
2. Characteristics Data types (i.e Char)
3. Characteristice Field lengths
I have looked into the SAP help for CCM 2.o and the on SAP Servicemarketplace under instguides&IBC....could not find every thing I wanted.
Regards,
GraceHi Grace,
you can look in tables
/CCM/C_CHAR
/CCM/C_CHAR_ALS
/CCM/C_CHAR_ASPT
/CCM/C_CHAR_TXT
/CCM/C_CHR_ALIAS
and
/CCM/C_DTYPE
/CCM/C_DTYPE_HDR
/CCM/C_DTYPE_T
/CCM/C_DTYPE_TXT
/CCM/C_DTYPE_VL
/CCM/C_DTYPE_VLT
in CCM to get the standard charcateristics and their default settings.
Chris -
Problem while creating with QUAN and CURR data type fields
I am trying to create a Z table. A couple of fields are of data type QUAN and CURR, which need to have reference table and reference field.
Field DataType Length Decimal
TOT_QTY QUAN 15 3
PRICE CURR 16 2
For reference table and fields, I found a Table HRPAD23 which has a field called N_QUANTITY (15,3) that matches my TOT_QTY field's data type and it also has a field called UN_PRICE that matches my PRICE field's data type. But when I use them as reference, and try to activate the table, I get an error "combination reference table/field does not exist". How do I fix this? Can anybody help me? Thanks in advance.
Chris
Edited by: martin99 on Aug 18, 2011 9:16 PMMartin,
I doubt that you need to add 2 extra fields in your table as suggested in the last post by John.
Your error is very CLEAR that you seem to be use wrong combination of reference table and field.
For QTY field,
use ref table - HRPAD23. ref field- UNIT
OR
ref table - VBAP ref field - VRKME
For PRICE field,
use ref table - PAD25 ref field - KWAER
OR
ref table - T77REFDOC ref field - CURRENCY
It should work.
BR,
Diwakar -
Hi Guru's,
Can anyone help me about my program.?
How can i get the exact length of a field so that when they are concatenated they have the same size of the field.
Thank You in advance.
Regards,
dranelhi,
To find out the field length of a data object, use the LENGTH addition:
DESCRIBE FIELD <f> LENGTH <l> IN CHARACTER MODE | IN BYTE MODE.
exp.
DATA: text(8) TYPE c,
len TYPE i.
DESCRIBE FIELD text LENGTH len IN CHARACTER MODE.
o/p:-
Field LEN contains the value 8.
regards
Gaurav -
Assigning a string value to a decimal data type field.
Hi,
I want to assign a value 'N/A' to an internal table field 'itab-field1' which is of data type dec.
How can I do this?.
Your help is really apprieciated
Thanks & Regards,
Soumya.hi,
on what condition do u want N/A to be displayed, i hope when ever that field is empty...
so u can do in this way..in stead of changing in internal table...
when ever u r writing the values from internal table to output list..
ther put a check like if itab- field1 = 0.
write :/ 'N/A'.
else.
write : itab-field1.
hope this is helpful, because we can not pass char values to internaltable field of type dec..
Rgds.,
subash -
Data Type field read only in Data source for transaction data (PC_FILE)
Hi folks,
I need to change Data Type for some of the fields in "Field" tab in data source for transactional data. It became read only after I activate the data source. Need help in making it editable. All fields now have Data type=CHAR.
ThanksNevermind folks. I got it.
-
Fixed length for the fields of ALV output
Hi,
How to fix a field in the ALV output to its max length..For example..if a field's max length is 10...that coloumn should not be dragged or moved to right..Its lenght shluld be fixed to 10...Could any bod suggest me how to perform this...thanks..
Shyam.Hi,
U can better optimize the width.it will be good.
data : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'T_ALV'
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FIELDCAT_ALV
I_CALLBACK_TOP_OF_PAGE = 'ALV_TOP_OF_PAGE'
TABLES
T_OUTTAB = T_ALV
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Fixed length select list fields
Is it possible to fix the width of a Select List field? I don't want it to auto-resize to the max width of the values in that column, but see no way to do that on the page editor. Thanks.
Hi Mike:
To fix the width of a select list item, set
style="width:120px;"
in the HTML Form Element Attributes of the element
Regards, Marcelo
Maybe you are looking for
-
How do I transfer iTunes account to a new computer?
How do I transfer my ITunes accout to a new computer?
-
CS5 text threads super slow in CS5.5?
Hi-- I have really large files from CS5 that I am now trying to work on in 5.5. (They are shelf ID's for items that go on store shelves, if anyone else is doing that kind of work) . In each file, I have rows of UPCs in individual text boxes that are
-
I have been using USB 2.1 10/100M ethernet adaptor. But it takes more than 15 mins to detect network interface. What should I do. I am not using apple's company adaptor. It's local company.
-
How can print Appraisal Document in ESS/MSS
Dear Experts. We are using ESS/MSS with BP 1.41 and we are Working Appraisal Document with WD ABAP. I want know if is posible using funcionallity standard print the Appraisal Document in ESS/MSS? If the reponse is Yes, How can do this? Best Regards C
-
Binding the UI element to the table in Adobe form
HI all, I am working in Adobe Form.The form contains attributes like name,address,country,etc.. In the same form i`ve created a table with all these attribute as a coloumn header. when the user click the submit button the data wh