Prevent Character in a praticular column
I am creating a grade book. I have a grades column that is set to Text. I have what is needed to change the text to number . The problem is I only want the following letter to be allowed in the field. That is NA or ABS I do not want no other text to be able
to be saved in the field i.e !@@#>.<, etc. How do I do this and should I use a trigger to make it happen.
Thanks in advance
You are thinking backwards. You should not seek to PREVENT values from being entered. You should seek to ALLOW specific values. You do this using a constraint. In addition, you asked this same question with a slightly different context
a long time ago - you might want to review the responses since they are likely to be similar and useful
disallow letters in varchar
Similar Messages
-
How do i prevent display of a particular column in ALV
How do i prevent display of a particular column
of a structure in ALVHi Serdar,
Please do let us know the link , as soon as your code sample is put in sdn.sap.com.
I request the <b>veteran members</b> of this forum to <b>contribute to WebLogs</b> or <b>code samples</b>, since over the time, the same questions will be asked and instead of repeating the answers, we can direct them to Weblogs or Code Samples.
There is an ABAP FAQ present in this site, which has given insight to so many things, that I have not even considered remotely possible.
As seen today, there was a useful piece of code posted. Instead of posting the code in the forum, you can create it as a weblog and post it there.
Regards,
Subramanian V. -
Replace a single character in a textual column in sql server
Hello,
could you confirm to me that:
UPDATE TableName
SET LastName = REPLACE(LTRIM(RTRIM(LastName)), 'A', 'B')
replaces every occurrence of character A with character B, in selected column, regardless
of the position of the letter A? (I.E., it could be only at the beginning of the last name, at the both i.e., at the beginning and somewhere in a middle etc....just any occurrence of it?)select REPLACE(LTRIM(RTRIM(lastname)), 'A', 'B') from tablename
Yes, It will update all occurence of character 'A' of lastname.
You can also execute the select statement for cross verfication
-Prashanth -
To Extend the length/character in the text column in FBCJ
Hi Experts,
Is there any way to extend the length/character in the text column in FBCJ? If yes then kindly revert me back as soon as possible. My Client needs more characters then the exist one..
Thanks in AdvanceHi
You have two text fields
Addit .text1 with 100 length
Addit text2 with 30 length
If you still need more ask your abaper to check table ISCJ_E_POSTINGS with field text100 and text30
Srinivas -
A special character in the last column in my external table
Hello,
I'v made a external table that looks like this :
CREATE
TABLE "REC_XLS"
"FINANCE_DATE" VARCHAR2(50 BYTE),
"CREATION_DATE" VARCHAR2(50 BYTE),
"SENT_DATE" VARCHAR2(50 BYTE),
"REMARKS" VARCHAR2(200 BYTE),
"REMAINING_QUANTITY" VARCHAR2(30 BYTE),
"CODE" VARCHAR2(30 BYTE)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER DEFAULT DIRECTORY "LOADER" ACCESS PARAMETERS (
RECORDS DELIMITED BY newline LOAD WHEN CODE!=BLANKS Skip 1 FIELDS
TERMINATED BY 0X'09' MISSING FIELD VALUES ARE NULL REJECT ROWS
WITH
ALL NULL FIELDS ( Finance_date,
creation_date, sent_date, Remarks,
remaining_quantity, code) location ( 'Finance.tsv' )
I exported the result in xls file and I saw in the last column a special character. The result of a copy and paste is prenseted here : "ABE
You should notice that the last quote is in the upper line instead of at the end of ABE. This means, I think, that there is a carriage return at the end. And the 0X'09' is the tab separator. How can I get rid of this character ?my guess is that you run the load on unix server which uses default LF end-of-line character and the file has dos CRLF end-of-line, the easiest option is to change records delimiter in the DDL and replace "RECORDS DELIMITED BY newline" with code below
RECORDS DELIMITED BY '\r\n'in general end-of-line can be really any character, sample above shows CRLF but it can be TAB, space, | or any other character or set of characters. I have samples of special characters on my blog http://jiri.wordpress.com/2009/01/29/oracle-external-tables-by-examples-part-1/
hope this helps
jiri -
How to display sinlge character in o/p column(matnr) in Alv
Alvreport:
material no in output is displaying Matnr
sdmo46dm0012
from the above i want to display only fifth character in o/p:
Matnr
required o/p: 4
please answer me with coding as soon as possible.In the internal which you are using to display the data replace the MATNR just by the fifth character of the MATNR.
LOOP AT ITAB ASSIGNING <FS_ITAB>.
<FS_ITAB>-MATNR = <FS_ITAB>-MATNR+4(1).
ENDLOOP.
Or you can have a different column which can be used for display purpose of that one character, you will have to have that extra column in the internal table as well as the field catalog.
Regards,
Ravi
Note - Please mark all the helpful answers -
ALV grid, prevent return to line 1 column 1 after using filter button
How can I prevent the ALV grid display from returning to line 1, column 1, after a user has modified the display using the filter or sort button ? I know this is possible using the is_stable field when control is passed to my ALV code, but when the automatic on-screen buttons are used I can't find a way of controlling how the screen is displayed.
Max,
Thanks, the AFTER_USER_COMMAND event allows me access after the filter or sort button has bee npressed, but I am unable to prevent the grid from reverting to column1 line1. By using the method GET_CURRENT_CELL I can find out the column, but it does not return me the row. I have tried putting this column id into SET_CURRENT_CELL_VIA_ID, as suggested by Naimesh above, and calling this from the AFTER_USER_COMMAND method, but it does not effect how the grid displays.
Any further advice would be very welcome. -
Replace any occurence of a character in a varchar2 column
What would be the best way to replace any occurence of a character in a column (varchar2) of a table?
Lets say we want to replace any occurence of the character ~ by the character & in the column c1 of the table t.
Is it possible in pure SQL?
I did it in PL/SQL in a while loop but I am pretty sure there is a way to do that in a single SQL statement. Am I right on wrong?
Thanks
Best regards,
CarlThe Ampersand has a special meaning in SQL to mark a variable.
That's why you need to set 'scan off' or 'define off' or
For more information see here
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1012408
set scan off
update t
set c1=replace(c1, '~', '&'); -
Insert ' character in a varchar2 column
How can i insert ' character in a column. For example I want to insert
HARINDER ' KANDA
in a name column in one of tables. I get the message "Quoted String not properly terminated"Hello Dear,
Just use single quotes two times instead of one like:
HARINDER''KANDA
Remember that it's two single quotes one after another not a double quote. -
Hi,
We have created a SharePoint site column with below settings
1. ShowInEditForm - False
2. ShowInNewForm - False
3. ShowInDisplayForm - True
With the above definition, the site column showing only in view properties form not in New and Edit forms. This column is added to a document library and updating this column value will be managed by event receiver code when a document is uploaded.
Till this point, everything is working OK.
But the issue is when we download and open a document from the above document library, under document properties the above column (with value) is visible along with other document default properties and this column value is editable. With this issue,
user is able to set a new value and overwrite the existing value by re-uploading the document.
Could you please let me know how to handle this issue so that user should not be allowed to edit except viewing the value/property (read only)?
Thanks in advance.
Regards
RameshYou can set "ShowInFileDlg" property of field to "FALSE". Using this you will not see that field in document properties list
-
Strange Problem When Inserting " £ " character in a varchar2 column
Hello
This is a very strange issue i am facing when i use SQL+ on different clients.
Client 1 ( SQL+) 9.2.0.4.0
conn scott@ora9i
SQL> insert into dummy values( '£');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from dummy;
A
¿
Client 2 ( SQL+) 9.2.0.4.0
conn scott@ora9i
SQL> insert into dummy values( '£');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from dummy;
A
£
Has any one faced this issue before , I am sure it is something to do with Client Language / Character .
Any help would be much appreciated.
Thanks
HarshadCheers Mate , You are a Star ,
Thanks Once again .
Regards
Harshad -
Preventing update of a single column
Hi All,
I'd like to ensure that values in a certain column are never updated, not even by the table owner. I have the following solution, but I'm interested to see if anyone out there has better alternatives. A check constraint solution would be ideal, but I'm not sure if it's possible.
SQL> create table t (pk number not null primary key, col varchar2(2) );
Table created.
SQL>
SQL> create or replace trigger t1
2 before update of pk on t
3 for each row
4 begin
5 raise_application_error
6 ( -20000, 'You cannot update PK values in this table.' );
7 end;
8 /
Trigger created.
SQL>
SQL> -- these commands should work
SQL>
SQL> insert into t values (1, null);
1 row created.
SQL> insert into t values (2, null);
1 row created.
SQL>
SQL> update t set col = 'xx';
2 rows updated.
SQL>
SQL> -- this one should fail
SQL>
SQL> update t set pk=pk+1;
update t set pk=pk+1
ERROR at line 1:
ORA-20000: You cannot update PK values in this table.
ORA-06512: at "SCOTT.T1", line 2
ORA-04088: error during execution of trigger 'SCOTT.T1'No need to disable anything:
SQL> insert into t t1
2 (pk, col)
3 select pk + 100
4 ,col
5 from t;
2 rows created.
SQL> select *
2 from t;
PK CO
1 xx
2 xx
101 xx
102 xx
SQL> delete t
2 where pk < 100;
2 rows deleted.
SQL> commit;
Commit complete.
SQL> -
Preventing column to be in insert query when value is null
I'm running DB and have a column defined as GENERATED ALWAYS.
What this means is that I can't use insert into table(col) values (null) because DB2 does not want the column to be part of the insert query at all.
Is there a way to prevent toplink from generating the column when its null?Hi jsutherl,
If I set setIsReadOnly(true) in my session customzier and specify insertable and updateable as false, I get the followine error:
Exception [TOPLINK-46] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: There should be one non-read-only mapping defined for the primary key field [TBL.PERSON.ID].
Descriptor: RelationalDescriptor(com.x.entity.Person--> [DatabaseTable(TBL.PERSON)])
I'm guessing this is because ID is a primary key and its forcing me to have a non-read-only mapping.
But the dillemma is that if I specify a non-read-only mapping than any insert on the table results in Toplink inserting the Java type null for the column which results in the following exception:
Internal Exception: com.ibm.db2.jcc.b.SQLException: A value cannot be specified for column "ID" which is defined as GENERATED ALWAYS.
This is because the field is defined as an IDENTITY in DB2.
Any thoughts? -
Storing a Non Printable -from keyboard- Character in Varchar2 Column
Hi,
I want to store a non-printable character in a varchar2 column. This character should be non-printable -from keyboard- for all character sets -or very difficult to print from keyboard-. It doesn't matter, whether it can be displayed on screen or not. It does matter INSTR function returns the character position of that character. It should be able to import export data without any problem for any NLS specific operating environment. For example, I plan to use chr(1) do you think it's appropriate? I appreciate your helps.
Best Regards,
SalimWhat is the business requirement you're trying to satisfy?
If your database character set is based on ASCII, CHR(1) (the Start of Header) character is likely to be transferred between systems without character set conversion. Non-ASCII character sets (i.e. Big5 for Chinese data) don't necessarily share the same control characters, though, and generally won't have the same binary representation of an ASCII control character (so CHR(1) in a non-ASCII based database wouldn't necessarily return the same character that CHR(1) would in an ASCII based database).
Justin -
How to select each character of column value
Hi All,
How can i get each character separately of a column value in a select statement.
LIKE i emp table if ename='Test' then i want
a select statement that can give me the result like this
T,e,s,t
Regards,
Anil Ror this?
SQL> create table mytable
2 as
3 select 'test' text from dual union all
4 select 'a text, containing two comma''s (,)' from dual union all
5 select 'a text ending with a comma,' from dual
6 /
Tabel is aangemaakt.
SQL> select text
2 , substr(regexp_replace(text,'(*?)',',\1'),2,length(text)*2-1) with_commas
3 from mytable
4 /
TEXT WITH_COMMAS
test t,e,s,t
a text, containing two comma's (,) a, ,t,e,x,t,,, ,c,o,n,t,a,i,n,i,n,g, ,t,w,o, ,c,o,m,m,a,',s, ,(,,,)
a text ending with a comma, a, ,t,e,x,t, ,e,n,d,i,n,g, ,w,i,t,h, ,a, ,c,o,m,m,a,,
3 rijen zijn geselecteerd.Regards,
Rob.
Message was edited by:
Rob van Wijk
Slight modification to cater for strings beginning and ending with commas.
Maybe you are looking for
-
Unable to print to network HP 3845 using Windows 7
I have an HP 3845 Color Deskjet connected directly to a machine running Windows 2000 with printer sharing enabled. All of my Windows XP Laptops have been able to print to this printer over my wireless network. However, I have been unable to get my ne
-
HP officeJet Pro 8610 can't connect to wireless router
Just bought a HP officejet Pro 8610, switched on the wireless mode. It won't connect to my Netgear router D6200. It tries to look for the networks in the house and the software hangs. I took it back to the shop and exchanged it with a new printer. I
-
I'm trying to add a new network printer to my list, so I open up Printer Utilities, and click "Add". Nothing happens. No error messages, nothing. Anyone know how to tell what's going on here? It's worked fine in the past. iBook G3 Mac OS X (10.3.9)
-
Can't pair iPhone 5 w iTronic bluetooth
I paired my iPhone 4s in 2 seconds with my aftermarket iTronic bluetooth system in my car. My iPhone 5 refuses to pair. I see the iTronic option to pair under Bluetooth (devices), as before when I paired my 4s. I hit the iTronic (not connected) fi
-
Hi Friends, I have install NW AS JAVA only on windows 2008 sp2 server. Installation completed successfully, but now when i am trying to start sap it gives some error. I have pasted the logs below. Some valuable suggession will be appriciated.....Than