SQL & PL/SQL :: Replace Non Alpha Numeric Characters

Jul 1, 2004

I have a function that will replace the contents of the input parameter and replace any non-numeric characters.� I just want to know if there is a more efficient way to code this (oracle 8i or higher).

function strip_non_numeric(p_string in varchar2) return varchar2 is
Result varchar2(100) := '' ;
x_length number;
begin
SELECT LENGTH(p_string) INTO X_LENGTH FROM DUAL;
FOR i in 1..X_LENGTH LOOP

[Code]....

View 6 Replies


ADVERTISEMENT

SQL Query For Checking Alpha-Numeric Values

Sep 22, 2009

In my table ,data type of one among 10 columns is defined as varchar2(10).I need to check that column should accept only numeric value(0 to 99) or alphabetic value(a to z or A to Z) .It should not accept Alpha-numeric values.I tried like this

select c3 from demotab where to_number(c3) not between ascii('a') and ascii('z') ;

but I got error like 'Invalid Number'.how to implement this thro sql query.

View 3 Replies View Related

Forms :: Alpha Numeric Sequence Updating

May 18, 2012

We have document serial Nos increment program, which has the below query for selecting and Updating, which generates a Numeric Value;

Select Query:

Select doc_slno
from fin_jv_slno_mas
where jv_month = '05' and
jv_year = '2012'

Output of this Query: 800001

Update Query:

update fin_jv_slno_mas set doc_slno=docno+1 where
jv_year = '2012' and
jv_month = '05'

Output after Updation: 800002.

The above query is a normal Sequence updating for a Numeric Value; now we need to update it as Alpha Numeric as below

Example: 8A0001

How can we give the above update statement for Alpha Numeric updation?

View 16 Replies View Related

PL/SQL :: Translate Function Remove Alpha Characters From String

Feb 7, 2013

I am on 11g.

I need to remove the alpha characters from a string, leaving only numbers, but I am getting unexpected results:

SQL> SELECT TRANSLATE('3N', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', NULL) a FROM DUAL;
A
-

I thought this would leave the 3 from the 3N, but it is returning an empty string. For my application, the string '3N' could be any length, will only contain letters and numbers, and the letters will always come at the end, but there could be more than one letter

VALID INPUT samples:
4
25
11F
361NG
8ABC

View 6 Replies View Related

NLS-NUMERIC CHARACTERS Changes?

Jun 20, 2011

I have set NLS_NUMERIC_CHARACTERS to ',.' but somehow during my java application life-cycle it got changed to '.,'! Is there any way to find what causes this? I can't find what or who change it. I have ordinary Java app which connects to Oracle 11.2.0.1.0 DB and as far as I know NLS_NUMERIC_CHARACTERS is not set explicitly or any other NLS_XXX setting. Is there any way to look in some logs for this?

View 1 Replies View Related

SQL & PL/SQL :: Replace Characters In A String?

Apr 7, 2011

replace the first 5 commas with the character '|' in the below string:

'Red, White, Blue, Purple, Pink, Green, Yellow, Gold and many others, like Black and Silver'

I tried:

SELECT regexp_replace('Red, White, Blue, Purple, Pink, Green, Yellow, Gold and many others, like Black and Silver',
',','|',1,5) from dual

but it only replaces the 5th comma.

View 3 Replies View Related

SQL & PL/SQL :: Replace Special Characters By SPACE?

Oct 18, 2010

i have a database column holding first name and last name. I want to find out the special characters and convert it to empty space.

Eg : kishore's 001 ==> kishores 001

: jerryKumar* ==> jerryKumar

View 2 Replies View Related

PL/SQL :: Replace All Characters Of Variable With Number?

Jun 3, 2013

i am working on the oracle 10g.currently i want to build one procedure,where i get a variable which contain character as well as number.my aim in the procedure is to replace all the character like ( a,b..z) in this variable with the number field.

example

suppose i have one variable say

var := 'MALT011000012345MTLCAST001SMT84'
now i want to replace each character say
A with value 23
B with value 56
L with value 99
9 i will get these value form another table).

i will have handle thousands of variable and they can start with any character and they contain character anywhere.

View 4 Replies View Related

SQL & PL/SQL :: Replace Double Space With Single Space And Also Remove Junk Characters

Jul 1, 2013

I want to replace double space with single space and also remove junk characters from the data. How can I do that?

CREATE TABLE test07013
(
NAME VARCHAR2(50)
);
INSERT INTO VALUES ('WARREN,'); -- REMOVE ","
INSERT INTO VALUES ('CLARK H'); -- REPLACE "DOUBLE SPACE" WITH "SINGLE SPACE"
INSERT INTO VALUES ('BRYAN A.'); -- REMOVE "."
INSERT INTO VALUES ('CARTER JR. ROBERT'); -- REMOVE "."," AND REPLACE "DOUBLE SPACE" WITH "SINGLE SPACE"

View 8 Replies View Related

SQL & PL/SQL :: Trigger - Non-numeric Character Was Found Where Numeric Was Expected

Oct 10, 2011

I have an sqlldr process running loading data into my database. I have created a trigger to run before inserts on each row to start gathering summary data from the basic underlying data. The trigger compiles ok and the procedures the trigger is calling compile ok, but when the sqlldr process runs I get errors in the log files.

Here is the sqlldr control file:

LOAD data
APPEND INTO TABLE cdr.day_tables
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(
RecordCode
,CdrStart DATE 'YYYY DDD SSSSS'
[code].......,

Next is my trigger

create or replace TRIGGER BNUMBER_SUMMARY_INS
BEFORE INSERT ON DAY_TABLES
FOR EACH ROW
DECLARE
[code]......

Next are the procedures that are called by the trigger:

create or replace PROCEDURE BNUMBER_SUMMARY
( BNUMBER IN VARCHAR2
, CALLDATE IN DATE
, CALLDURATION IN NUMBER
) AS
record_found NUMBER;
BEGIN
[code].......

The error messages I am getting are:

Record 1: Rejected - Error on table CDR.DAY_TABLES, column CDREND.
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "CDR.BNUMBER_SUMMARY_INS", line 6
ORA-04088: error during execution of trigger 'CDR.BNUMBER_SUMMARY_INS'

I need to find out what field it is complaining about, especially since I am not even using the cdrend field from the input record?

View 14 Replies View Related

SQL & PL/SQL :: ORA-01858 / Non-numeric Character Was Found Where Numeric Was Expected

Apr 22, 2013

select ORDER_NUMBER from OE_ORDER_HEADERS_ALL
WHERE ordered_date=to_char(to_date(substr(ORDERED_DATE,1,10),'YYYY/MM/DD'),'DD-MON-YYYY');

Error:-ORA-01858: a non-numeric character was found where a numeric was expected

View 13 Replies View Related

Non-numeric Character Found Where Numeric Was Expected?

Jun 1, 2007

I get the error message mentioned in the subject with this SELECT-statement

....where (t.cfonte=14 and t.data_ultima_modifica between sysdate -4000/(24*60*60) and sysdate ) or (t.data_ultima_modifica > to_date('%TIMESTAMP%','ddmmyyhh24miss'))]]>

If I substitute %TIMESTAMP% with 310507143709 then it works

View 6 Replies View Related

SQL & PL/SQL :: Non-numeric Found Where Numeric Was Expected

Dec 7, 2010

We are getting an error : a non numeric was found where a numeric was expected sometimes when this statement is executed:

INSERT INTO training select * from temp_training where class_id='xyz';
all columns and their datatypes are the same in both the tables

however if i replace the * with the column names as shown below it seems to work fine without giving an error

insert into training (a,b,c) select a,b,c from temp_training where class_id='xyz'

wanted to understand the subtle difference between the 2 statements

View 5 Replies View Related

SQL & PL/SQL :: Removing Special Characters And Get Desired Characters From Column Values

Jul 23, 2013

create table test
(
name varchar2(50),
descd varchar2(50)
)
insert into test values ('kethlin','da,dad!tyerx');
insert into test values ('tauwatson','#$dfegr');
insert into test values ('jennybrown','fsa!!trtw$ fda');
insert into test values ('tauwatson','#$dfegr ,try');

how do I get the first three characters and last three characters from name field and remove all the junk characters from descd field?

so my o/p be like;

Quote:('ketlin','dadadtyerx')
('tauson','dfegr')
('jenown','fsatrtw fda')
('tauson','dfegr try')

View 6 Replies View Related

SQL & PL/SQL :: REPLACE ON USER_MVIEWS / Number Cannot Be Replace

Jul 16, 2010

I have 70 materialized views where I need to replace the FROM SCHEMA1 TO FROM SCHEMA2...To quickly to do the fix for all the 70 views..

SELECT REPLACE (QUERY, 'schema1', 'schema2' )FROM USER_MVIEWS ;

But It throws me an error that Number cannot be replace.

View 14 Replies View Related

SQL & PL/SQL :: Replace Y By N And N By Y

Sep 14, 2010

I want to Update table value N by Y and Y by N.

ex.

col1
y
y
n
n

output:

col1
n
n
y
y

How can i do that ?

View 10 Replies View Related

ORA-06502 - PL/SQL - Numeric Or Value Error

Jul 29, 2011

I have a requirement in which I have to append LOBs and I have to insert the LOB into a table column. I am facing problem when the data exceeds certain limit. (please note that my program logic is given below, not the exact program)

DECLARE

final_html CLOB;
int_html CLOB;
v_str VARCHAR2(32767);
i number:=0;
BEGIN
dbms_lob.createtemporary(lob_loc => int_html, CACHE => TRUE, dur => dbms_lob.CALL);
dbms_lob.createtemporary(lob_loc => final_html, CACHE => TRUE, dur => dbms_lob.CALL);
DBMS_LOB.OPEN(int_html, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.OPEN(final_html, DBMS_LOB.LOB_READWRITE);
dbms_output.ENABLE(1000000);
[code]....

when the looping is done for lesser value say for e.g FOR i IN 1..10 loop, the program works fine, but when the looping is done for more values I am getting "-6502-ORA-06502: PL/SQL: numeric or value error" error message.

View 1 Replies View Related

SQL & PL/SQL :: ORA-06502 - Numeric Or Value Error?

Dec 18, 2012

create or replace package pckname is
Procedure VALIDATE_USER(p out credentials.pc%TYPE,
u in credentials.uc%TYPE,
c in credentials.sc%TYPE);
end pckname;

I m getting error at line 1 and line 8:

View 1 Replies View Related

SQL & PL/SQL :: Convert To Numeric / Date

Jan 30, 2013

I currently have a table with a VARCHAR column which is used to store notes. Currently the notes read something like 'Verified 01/01/2012'. I am trying to convert it to a date column so I can run reports using the date (select between dates etc).

I have tried with the substr function but since the records are all different doesn't really work. (plus that doesn't make it a date so not sure it would work for searching).

how to proceed?

View 3 Replies View Related

ORA-20507 Invalid Numeric Value N

Jun 13, 2011

I am using APEX 4.0.2.00.06 on a Linux server running Oracle 11g R2 and have the following problem:

I have a page with two forms for creation of new rows in either the sites table or the site-projects table. Site-projects is defined as follows with four numbers and two character fields:

Site_id number(10,0) PK1
Cruise_id number(10,0) PK2
Sequence_number number(10,0) PK3
Project_id number(10,0)
Assigned_flag varchar2(1) default �N�
Planned-site_flag varchar2(1) default �N�

The entry form uses select lists for many of the fields, but it is the assigned_flag that seems to be causing problems. It�s LOV definition is static2:UNASSIGNED;N,ASSIGNED;Y
When I tap the create button, I get :

ORA-20507: Invalid numeric value N for column ASSIGNED_FLAG Error Unable to process row of table SITES.

This suggests that something is going on at the sites table even though I use the create button associated with the site-projects table. Am I invoking the row processing for the sites table as well? Why does it run into invalid number when the field is varchar2? Actually, I get the exact same error if I use the create button on the sites portion of the page.

The site table has the following columns:

Site_id number(10,0) PK1
Parent_site_id number(10,0) nullable
Stratum_id number(10,0)
Area_id number(10,0)
Site_type_id number(10,0)
Name varchar2(50)

View 2 Replies View Related

Forms :: Numeric Input In 6i

Jul 25, 2005

I have an issue in oracle form 6i. I want to create an input box that accepts only number. As the user press any key other than allowed for numbers it should not accept.

View 4 Replies View Related

SQL & PL/SQL :: Convert Date To Numeric

Oct 8, 2012

I currently have a field which stores a date (date employer started with the company). I want to create a view which stores this as number of days employed (e.g. if star date 1st October view will say 8). How to convert a date to a number?

View 14 Replies View Related

PL/SQL :: Delete Non Numeric Values

Dec 20, 2012

I have a set of data within a table with a column called telephone_numbers. What I have noticed is that for some reason I have data in there that is not numerical values only i.e. LLSSUU. Is it possible to delete all non numerical values from this column?

The problem is I have over 1000 fields to go through and was wondering if there is a query that i can write.

View 12 Replies View Related

PL/SQL :: SQL Query Concat Numeric Or Value

Jan 3, 2013

I am getting numeric or value error when concatenating sql script..

Here is the sample, I have in the stored proc.. firstpart:_ works fine if I comment the secondpart:_. (I modified the query because I am posting in the public forums)

V_SAMPLEQUERY VARCHAR2(2000);
     
firstpart:_

V_SAMPLEQUERY := '      
SELECT
AB.ABCDID AS ABCDID,
CD.MEMBERID AS MEMBERID,

[Code]..

secondpart:_ ***ERROR PART***

V_SAMPLEQUERY := V_SAMPLEQUERY || ' ORDER BY AB.USER'; -- Here I am getting error saving ORA-06502 - numeric or value error

View 2 Replies View Related

SQL & PL/SQL :: How To Replace Apostrophe

Jan 4, 2011

I have a table MOM i.e. Minutes of meeting where important points in a meeting are captured. Now these points may include words like, "don't" or "can't" which will be recorded first in a text file and later copied to the table MOM. Rest of the details are unimportant. All I want to know is how do I enter these words without getting the ORA-01756 error? Do I need to always correct them before entering or is there perhaps another way?

View 2 Replies View Related

SQL & PL/SQL :: Replace String In 9i?

Jun 26, 2012

I want to replace numeric values of a specific format with 'X' , find the below example and note that the string in the example only for sample values and the strings may be different.

Eg.

Input String :

Ticket no 12343 , 1234567891234567 , origin-dxb , dest-lhr , 1234 5678 9012 2345 , address - rose wood
bldg 2444 , downtown ,london-33 .

Output string :

Ticket no 12343 , XXXXXXXXXXXXXXXX , origin-dxb , dest-lhr , XXXX XXXX XXXX XXXX , address - rose wood
bldg 2444 , downtown

View 6 Replies View Related

SQL & PL/SQL :: Replace Comma With '�10'?

Jan 23, 2012

TestCase

DROP TABLE test ;
CREATE TABLE test (id NUMBER, cnt_str VARCHAR2(200));
INSERT INTO test (id, cnt_str) VALUES
(1,'AKRN000002,1451-1473,00000A,74,AKRN000002,1475-14791000000A,8010AKRN000002,1481-1492,00000A,9310AKRN000002,1494-1500')

[code]...

The requirement is in each of the string where there is comma after the number and the number is prefixed by "-" character,
the comma after the number should be replaced by '10'.

For example in the second record where ID = 2,
CNT_STR is '00000B,1-251000000D,26-32,ADTW000301,2858-2875'.
In this string -32, should become -3210 and resulting string should be '00000B,1-251000000D,26-3210ADTW000301,2858-2875'

Expected Result.

ID CNT_STR
-------- -------------------------------------
1 AKRN000002,1451-14731000000A,7410AKRN000002,1475-14791000000A,8010AKRN000002,1481-14921000000A,9310AKRN000002,1494-1500
2 00000B,1-251000000D,26-3210ADTW000301,2858-2875
3 AKRN000001,1126-12001000000B,501-525

View 4 Replies View Related

SQL & PL/SQL :: Replace Column Name

Sep 19, 2010

For example i've a select query as below.

1.select store_name, store_id from stores
2.select store_name, (select store_id from inventory where store_id=<somevalue>) from stores
3. select store_name, store_id from stores
where store_id in(select store_id from stores1)

based on above examples i need to replace all the columns(oly the column names not the column names in the subquery) in a sql query .

is there is any oracle function to achieve this?

and the result shud be as follows if i replace with STORE_DET.

1.select STORE_DET from stores
2.select STORE_DET from stores
3. select STORE_DET from stores
where store_id in(select store_id from stores1)

View 3 Replies View Related

PL/SQL :: How To Replace Execute Immediate In 11g

Jan 18, 2013

creating package and i need not to use execute immediate. There are some dynamic build plsql's and sql's stored in global lists. Any other possibility to run them without execute immediate?

View 3 Replies View Related

PL/SQL :: Replace A String

Sep 26, 2013

I have a string. For example "I have too many files. There are 1000 files. I have to delete them." Sometimes the string can be "I have too many files. There are 115003 files. I have to delete them." Whatever the srting is, I need to change the string to "I have too many files. There are 10 files. I have to delete them." replace the "1000" or "115003" to "10". This portion of the string is always an integer. I use Oracle 11G2. 

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved