Pl/SQL is prompting "invalid number" error
Hello Sir/Madam,
I'm not very clear why pl/sql cursor is prompting "invalid number" error.
I need to load single as well as multi Gas meter data for an automation process. The procedure is loading single meter data fine, but when I add multi meter data to that table it is halting and prompting "invalid number". I made sure that each record is unique. Define primary key based on three field ( they are: SERVICEPOINTID, METERID, and ENDDATE )
in the sample file, they are in that order
I would appricaite your help & explantions on this issue
sample procedure code:
CREATE OR REPLACE procedure GSO_SBX_ADMIN.row_add_v2 is
rct_cnt number := 0;
header_key gso_hourlylog_header.hrly_log_hdr_ky%TYPE;
dailyorder_key gso_hourlylog_header.DLY_ORDER_KY%TYPE;
customer_key gso_customer_log.CUST_KY%TYPE;
channel_key gso_cust_channel_privs.CHNNL_KY%TYPE;
custlog_key gso_customer_log.CUST_LOG_KY%TYPE;
hourly_custlog_detail_key gso_hourly_cust_log_detail.HRLY_CUST_LOG_DTL_KY%TYPE;
customer_name GSO_CUSTOMER_LOOKUP.CUST_NM%TYPE;
row_processing_status VARCHAR2(100) := '';
other_customerlog_issue VARCHAR2(5) := 'FALSE';
ls_curr_user VARCHAR2(30) := 'GSO_PROCESS_IEE_INTO_GSO';
record_processable VARCHAR2(5) := '';
rec_processing_timestamp TIMESTAMP;
begin
for daily_gis_add in
SELECT '', METERID, ENDDATE, HOURENDING, VOLUMEVALUE, CUSTOMERNAME, DEVICEID, CUSTOMERID, SERVICEPOINTID
FROM GSO_IEE_STAGE gis where trunc(gis.loaded_dt) = trunc(sysdate)
loop
insert into gso_iee_process_log
VALUES
rec_processing_timestamp,
daily_gis_add.METERID,
daily_gis_add.ENDDATE,
daily_gis_add.HOURENDING,
daily_gis_add.VOLUMEVALUE,
daily_gis_add.CUSTOMERNAME,
daily_gis_add.DEVICEID,
daily_gis_add.CUSTOMERID,
daily_gis_add.SERVICEPOINTID,
customer_name,
customer_key,
channel_key,
dailyorder_key,
header_key,
custlog_key,
hourly_custlog_detail_key,
row_processing_status,
SYSDATE
commit;
rct_cnt := rct_cnt + 1;
dbms_output.put_line(' rowadded '|| rct_cnt);
end loop;
end;
sample data:
32096040001 11048610FGI 5/25/2013 10 AM 10 Tower Hill School 1104861000217112 257808404 32096110001 6/21/2013 10:40:18 AM
26107010002 11086348FGI 5/25/2013 10 AM 10 Emily Bissell Hospital 1108634800050877 261070100 26107010002 6/21/2013 10:40:18 AM
32101140001 11086356FGI 5/25/2013 10 AM 10 Delaware River Bay Authority 1108635600413231 321011400 32101140001 6/21/2013 10:40:18 AM
31875230004 110680FGI 5/25/2013 10 AM 10 Arlon Inc. Gas 11068000021253 318752300 31875230004 6/21/2013 11:04:58 AM
31875230003 110681FGI 5/25/2013 10 AM 10 Arlon Inc. Gas 11068100022092 318752300 31875230003 6/21/2013 11:04:58 AM
Regards,
Vani Sonti
Hello,
I've commented out or removed the fields that are not listed.. here is the modified code.. I just added the part where is was prompting errors..
Yes, I tested just now and it is looping and printing all five record counters..
CREATE OR REPLACE procedure GSO_SBX_ADMIN.row_add_v3 is
rct_cnt number := 0;
begin
for daily_gis_add in
SELECT '', METERID, ENDDATE, HOURENDING, VOLUMEVALUE, CUSTOMERNAME, DEVICEID, CUSTOMERID, SERVICEPOINTID
FROM GSO_IEE_STAGE gis where trunc(gis.loaded_dt) = trunc(sysdate)
loop
insert into gso_iee_process_log
TIMESTAMP_ID, PREMISEID,METERID,ENDDATE ,HOURENDING,VOLUMEVALUE ,
CUSTOMERNAME,DEVICEID,CUSTOMERID,SERVICEPOINTID
VALUES
SYSDATE,
daily_gis_add.METERID,
daily_gis_add.ENDDATE,
daily_gis_add.HOURENDING,
daily_gis_add.VOLUMEVALUE,
daily_gis_add.CUSTOMERNAME,
daily_gis_add.DEVICEID,
daily_gis_add.CUSTOMERID,
daily_gis_add.SERVICEPOINTID
commit;
rct_cnt := rct_cnt + 1;
dbms_output.put_line(' rowadded '|| rct_cnt);
end loop;
end;
Vani
Similar Messages
-
Pl/sql function replying invalid number error
Hi,
I don't know if it's the late hour or I'm just missing something...
I wrote a very simple function which is compiling, but returning ORA error 017222 - nvalid number, every time it's executed...
Please let me know what am I missing...
Thanks!
create or replace
FUNCTION GAMES(
MINUTE_PLAYED IN NUMBER,
HOME_GOALS IN NUMBER,
AWAY_GOALS IN NUMBER)
RETURN NUMBER IS
HOME VARCHAR2(100);
AWAY VARCHAR2(100);
RELEVANT_GAMES NUMBER;
BEGIN
HOME := 'MIN' || MINUTE_PLAYED || 'HOME';
AWAY := 'MIN' || MINUTE_PLAYED || 'AWAY';
SELECT COUNT(*) INTO RELEVANT_GAMES
FROM FINISHED_GAMES
WHERE HOME = HOME_GOALS AND AWAY = AWAY_GOALS;
RETURN RELEVANT_GAMES;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END GAMES;869206 wrote:
Hi,
I don't know if it's the late hour or I'm just missing something...
I wrote a very simple function which is compiling, but returning ORA error 017222 - nvalid number, every time it's executed...
Please let me know what am I missing...
Thanks!
create or replace
FUNCTION GAMES(
MINUTE_PLAYED IN NUMBER,
HOME_GOALS IN NUMBER,
AWAY_GOALS IN NUMBER)
RETURN NUMBER IS
HOME VARCHAR2(100);
AWAY VARCHAR2(100);
RELEVANT_GAMES NUMBER;
BEGIN
HOME := 'MIN' || MINUTE_PLAYED || 'HOME';
AWAY := 'MIN' || MINUTE_PLAYED || 'AWAY';
SELECT COUNT(*) INTO RELEVANT_GAMES
FROM FINISHED_GAMES
WHERE HOME = HOME_GOALS AND AWAY = AWAY_GOALS;
RETURN RELEVANT_GAMES;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END GAMES;eliminate EXCEPTION handler!
do NOT rely on implicit datatype conversion
use TO_CHAR or TO_NUMBER as needed.
HOME & HOME_GOALS are different datatype -
Recieving ORA-01722 invalid number error while creating a materialized view
Hi,
I am receiving a ORA-01722 invalid number error while creating a materialized view. when run the select statement of the view i don't get any error, but when i use the same select statement to create a materialized view i receive this error. Could any please help in resolving this error. Here is the code i am using to create a materialized view.
CREATE MATERIALIZED VIEW MV_EBS_CH_CLOSED
REFRESH FORCE ON DEMAND
AS
SELECT DISTINCT kr.request_id, org.org_unit_name,
ebs_ch_ticket_type (kr.request_id) ticket_type,
DECODE
(kr.status_code,
'CLOSED_SUCCESS', kr.last_update_date,
'IN_PROGRESS', (SELECT MAX (start_time)
FROM ebs_ch_datastore ecd1
WHERE kr.request_id = ecd1.request_id
AND workflow_step_name =
'Final BA Review and Deployment Exit Criteria')
) closed_date,
substr(krhd.visible_parameter12,1,10) siebel_start_date,
kr.creation_date itg_start_date
FROM kcrt_requests kr,
kcrt_request_types krt,
kcrt_req_header_details krhd, kcrt_request_details krd1,
(SELECT koum.user_id user_id,
DECODE (koup.org_unit_name,
'IT Implementations', 'CHS - Service Management BA',
koup.org_unit_name
) org_unit_name
FROM krsc_org_unit_members koum, krsc_org_units koup
WHERE 1 = 1
AND 'Y' = koup.enabled_flag
AND koum.org_unit_id = koup.org_unit_id
AND EXISTS (
SELECT 'X'
FROM krsc_org_units kouc
WHERE koup.org_unit_id = kouc.org_unit_id
START WITH kouc.parent_org_unit_id =
ANY (SELECT org_unit_id
FROM krsc_org_units krsc_org_units1
WHERE 'Clearinghouse' =
org_unit_name)
CONNECT BY kouc.parent_org_unit_id =
PRIOR kouc.org_unit_id)
UNION
SELECT kou.manager_id user_id,
DECODE
(kou.org_unit_name,
'IT Implementations', 'CHS - Service Management BA',
kou.org_unit_name
) org_unit_name
FROM krsc_org_units kou
WHERE 'Y' = kou.enabled_flag
START WITH kou.parent_org_unit_id =
(SELECT org_unit_id
FROM krsc_org_units krsc_org_units2
WHERE 'Clearinghouse' = org_unit_name)
CONNECT BY kou.parent_org_unit_id = PRIOR kou.org_unit_id) org
WHERE krt.request_type_id = kr.request_type_id
AND krt.request_type_name IN ('Bug Fix', 'IT Enhancement')
and kr.REQUEST_ID = krd1.request_id
and krd1.batch_number = 1
AND kr.request_id = krhd.request_id
AND org.user_id in (krd1.parameter4, krd1.parameter5, krd1.parameter7)
AND ( 'CLOSED_SUCCESS' = kr.status_code
OR 'IN_PROGRESS' = kr.status_code
AND kr.request_id IN (
SELECT request_id
FROM (SELECT DISTINCT request_id,
MAX
(start_time)
closed_date
FROM ebs_ch_datastore
WHERE 'Final BA Review and Deployment Exit Criteria' =
workflow_step_name
GROUP BY request_id))
Thanks,
Shaik MohiuddinThis error occurs when you try to create a materialized view , but if you run the sql the results are perfectly fine. Well it happend to me also and to fix this I made sure all the coulmns have the same data type which are used in joins or in where clause.
use
where
to_number(col1)=to_number(col2) and to_number(col3)=to_number(col4)
hope this helps.. -
Invalid number error for bind dialog
Oracle SQL Developer version 1.1.2.25 BUILD MAIN-25.79
Running under WinXP
Issue description:
We get an invalid number error when bind variable filled with an enter in the bind dialogIt is hard to say what is causing your problem without the specifics (ie query and value entered for the bind variable). Try running the same statement with the value of the bind variable in place of the bind variable (ie instead of running "select * from dual where dummy = :var" with a value of 'x' for :var, run "select * from dual where dummy = 'x'"). If you get the same error, then it is not an issue with the use of bind variables.
Be aware that currently you cannot define the data type of bind variables (unlike TOAD, etc) and they are all treated as character values. I wouldn't have thought that this would cause you problem unless you are using a bind variable to restrict a numeric column to a specific value and you are entering a non-numeric bind (ie "select * from people where person_id = :id" and using 'xyz' as the value for :id). -
How to determine offending column in ORA-01722: invalid number error ...
When an error like
ORA-01722: invalid number error
occurs and you are dealing with many columns that could be the 'culprit', does anyone have a method by which
you can quickly determine offending column?SQL PLus will tell you:
SQL> create table t
2 (col1 number
3 ,col2 number
4 ,col3 number
5 ,col4 number
6 ,col5 number
7 );
Table created.
SQL> create table x
2 (col1 varchar2(10)
3 ,col2 varchar2(10)
4 ,col3 varchar2(10)
5 ,col4 varchar2(10)
6 ,col5 varchar2(10)
7 );
Table created.
SQL> insert into x values ('1','2','x','4','5');
1 row created.
SQL> insert into t(col1,col2,col3,col4,col5)
2 select col1,col2,col3,col4,col5 from x;
select col1,col2,col3,col4,col5 from x
ERROR at line 2:
ORA-01722: invalid numberAnd if you rearrange your sql like this, sql plus will give you the line number of the offending column:
SQL> insert into t
2 (col1
3 ,col2
4 ,col3
5 ,col4
6 ,col5
7 )
8 select col1
9 ,col2
10 ,col3
11 ,col4
12 ,col5
13 from x;
,col3
ERROR at line 10:
ORA-01722: invalid number -
ORA-01722: invalid number error. In Update
create or replace procedure San_Test (sInNum varchar2, outMsg out varchar2)
is
begin
update mtest set
mname = 'Success'
where id in (sInNum);
commit;
outMsg :='Success';
exception
when others then
outMsg :='Err';
dbms_output.put_line(sqlerrm);
end;
This is my test sp where i am getting ORA-01722: invalid number error.
Which is because the column data type is Number of ID and i have sInNum parameter as varchar2.. How can i achieve this ?
I don't have other way to do this please help.Great demonstration for SQL INJECTION, was that part of your OCP training?
CREATE TABLE mtest (id NUMBER, mname VARCHAR2(255));
INSERT INTO mtest VALUES (1, 'test');
INSERT INTO mtest VALUES (2, 'test2');
COMMIT;
CREATE OR REPLACE PROCEDURE san_test (sinnum VARCHAR2, outmsg OUT VARCHAR2)
IS
mnum VARCHAR2 (10);
strsql VARCHAR2 (250);
BEGIN
mnum := REPLACE (sinnum, '''', '');
strsql :=
'update mtest set
mname = ''Success''
where id in (' || mnum || ')';
EXECUTE IMMEDIATE strsql;
COMMIT;
outmsg := 'Success';
EXCEPTION
WHEN OTHERS
THEN
outmsg := 'Err';
DBMS_OUTPUT.put_line (SQLERRM);
END;
SELECT *
FROM mtest;
ID MNAME
1 test
2 test2And now for the fun part:
SET SERVEROUTPUT ON
DECLARE
v_put_msg VARCHAR2(255);
BEGIN
san_test('1) OR (1=1', v_put_msg);
dbms_output.put_line(v_put_msg);
COMMIT;
END;
SELECT *
FROM mtest;
ID MNAME
1 Success
2 SuccessC. -
Ora-01722 invalid number error within view
Hi, in my oracle 9.2.0.4.0 db, under TEST schema i've a view called PRODUTTIVITA_LINEE. I'm trying to create another view joining PRODUTTIVITA_LINEE with a table called LINEE. But when i execute the select (SELECT PRODUTTIVITA_LINEE.*, LINEE.NAME FROM PRODUTTIVITA_LINEE, LINEE WHERE PRODUTTIVITA_LINEE.LINEA_ID = LINEE.LINEA_ID), i obtain the ORA-01722 invalid number error.
But if i create a table PRODUTTIVITA_SUPPORT as select all fields from PRODUTTIVITA_LINEE and i use it in the new query (SELECT PRODUTTIVITA_SUPPORT.*, LINEE.NAME FROM PRODUTTIVITA_SUPPORT, LINEE WHERE PRODUTTIVITA_SUPPORT.LINEA_ID = LINEE.LINEA_ID), all works.
Using the view, the new query doesn't work, but using the same data toke from a table instead of view, all works. Why?Excuse me but i send modified script. Here the original script of object.
SQL> desc PRODUTTIVITA_LINEE;
Nome Nullo? Tipe
LINEA_ID NUMBER(9)
COD_LINEA_ANDATA VARCHAR2(8)
COD_LINEA_RITORNO VARCHAR2(4)
ID_TRAT_PIC_ANDATA NUMBER
ID_TRAT_PIC_RITORNO NUMBER
DESC_LINEA VARCHAR2(120)
EKM_NOMINALI NUMBER
EKM_SCONTATI NUMBER
KMLINEA NUMBER
ANNO NUMBER SQL> desc PRODUTTIVITA_SUPPORT;
Nome Nullo? Tipe
LINEA_ID NUMBER(9)
COD_LINEA_ANDATA VARCHAR2(8)
COD_LINEA_RITORNO VARCHAR2(4)
ID_TRAT_PIC_ANDATA NUMBER
ID_TRAT_PIC_RITORNO NUMBER
DESC_LINEA VARCHAR2(120)
EKM_NOMINALI NUMBER
EKM_SCONTATI NUMBER
KMLINEA NUMBER
ANNO NUMBER Both objects have 5400 records and are the same. -
ORA-01722: invalid number error when trying to pass a list of values
Gurus
We are using a function like so
The usage for the function below is
Select fn_st_bb_nm_uc (‘1232131312, 123213312’) from dual;
SQL> /
Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual
ERROR at line 1:
ORA-01722: invalid number
It’s giving an invalid number error. When we pass one value it is working fine but when we pass a string of values it gives this error. I have opened an SR around this but would greatly appreciate your help
Acc_blackbar is the table and acc_blkbr_id is of type number.
FUNCTION fn_st_bb_nm_uc (pBB_ID_LIST VARCHAR2)
RETURN VARCHAR2 IS
vspcm_typ_nm_uc VARCHAR2 (2000);
CURSOR stname
IS
SELECT distinct st.spcm_typ_nm_uc
FROM
acc_blackbar abb,
acc_specimen_type ast, acc_procedure apr,
acc_specimen_part asp,
specimen_type st, procedure pr,
proc_proc_family ppf
WHERE abb.ACC_BLKBR_ID = apr.ACC_BLKBR_ID
AND apr.ACC_SPCM_PART_ID = asp.ACC_SPCM_PART_ID
AND asp.ACC_SPCM_TYP_ID = ast.ACC_SPCM_TYP_ID
AND ast.ACC_SPCM_TYP_SPCM_TYP_ID = st.SPCM_TYP_ID
AND apr.procdr_id = pr.PROCDR_ID
AND pr.PROCDR_ID = ppf.PROCDR_ID
AND abb.acc_blkbr_id in (pBB_ID_LIST) ;
BEGIN
DBMS_OUTPUT.PUT_LINE(' BB LIST : ' || pBB_ID_LIST);
FOR st IN stname
LOOP
vspcm_typ_nm_uc := vspcm_typ_nm_uc || ',' || st.spcm_typ_nm_uc;
END LOOP;
vspcm_typ_nm_uc := SUBSTR (vspcm_typ_nm_uc, 2);
RETURN vspcm_typ_nm_uc;
END;This ask tom thread covers multiple solutions:
[http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425] -
Find the Column Name which gives Invalid Number Error
Hi,
There are about 150 columns in a table and data to this table is from a external source like flat file. when these data are loaded to the table for a particular column it gives Invalid Number Error. So need to find for Which Numeric Column a String Value is about to be inserted.
since we are sure not whether the proper Values are coming from Source in Front End we pass the Value within ' quotes.
So how do we get the Column for which the error is raised :-)If you are using SQL*Loader, the log will tell you which row and column has the error.
Otherwise you may need to code your own debugging statements. -
Invalid Number Error in Merge Statement
Hi all.
I got an invalid number error in the following merge statement, but I don't know why. Maybe you can give me a hint.
MERGE INTO wam_table
USING (SELECT * FROM wam_table) b
ON (b.username = 'user'
AND b.mod = 'module'
AND b.trimester = '1')
WHEN MATCHED THEN
UPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'
WHEN NOT MATCHED THEN
INSERT VALUES ('user','module','1','1','1','1','1', localtimestamp, 'username');
The invalid number error appears in the first line, but I don't know why?
StephanUPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'SELECT * FROM sys.v_$reserved_words;
SQL> create table test1(as varchar2(10));
create table test1(as varchar2(10))
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1(sno number, date date);
create table test1(sno number, date date)
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1("as" varchar2(10));
Table created.
SQL>
SQL> create table test2(sno number, "date" date);
Table created.
SQL> desc test1
Name Null? Type
as VARCHAR2(10)
SQL> desc test2
Name Null? Type
SNO NUMBER
date DATE
SQL> -
Invalid Number Error for Decimal Field While Loading Data
I am loading a delimited text file using the SQL* loader however I am reciving an error in my decimal fields. When a decimal field only has leading zeros before the decimal point I receive invalid number error. Below will clarify:
i.e.) 00000000.30 [*Invalid number*]
i.e.) 00046567.45 [*Valid number*]
i.e.) 00000001.00 [*Valid number*]
I've tried setting the precision/scale in the table, tried declaring it a decimal field instead of number, none of these methods fixed the issue. Any help I would really appreciate.
POLICY_NUMBER NUMBER,
EFFECTIVE_DATE DATE "YYYYMMDD" NULLIF EFFECTIVE_DATE = '',
TRANSACTION_DATE DATE "YYYYMMDD",
TRANSACTION_AMOUNT DECIMAL EXTERNAL, -- Tried TRANSACTION_AMOUNT DECIMAL EXTERNAL (10) & TRANSACTION_AMOUNT NUMBER
MF_TRX_CODE NUMBER,
USER_ID CHAR,
GROUP_NUMBER NUMBER,
EXPIRATION_DATE DATE "YYYYMMDD" NULLIF EXPIRATION_DATE = '',
BILL_NUMBER NUMBER,Any help is greatly appreciated. Thanks before hand.Hi,
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> SELECT * FROM TEST;
TRANSACTION_AMOUNT
SQL> SELECT * FROM TEST;
TRANSACTION_AMOUNT
11000,00
293,37
2000,00
1134,32
0,30
SQL>Between the selects I loaded the table with sql*loader using...
Load Data
INFILE *
APPEND
INTO TABLE TEST
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
TRANSACTION_AMOUNT DECIMAL EXTERNAL
BEGINDATA
00011000.00
00000293.37
00002000.00
00001134.32
00000000.30The log is
SQL*Loader: Release 10.2.0.1.0 - Production on Tue Dec 23 17:23:47 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: test.ctl
Data File: test.ctl
Bad File: test.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table TEST, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
TRANSACTION_AMOUNT FIRST * | CHARACTER
Table TEST:
5 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 16512 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 5
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Tue Dec 23 17:23:47 2008
Run ended on Tue Dec 23 17:23:50 2008
Elapsed time was: 00:00:02.86
CPU time was: 00:00:00.06Regards, -
Invalid Number Error in IR search bar.
Hi,
I am getting an invalid number error when i put a value in search bar without selecting the column name.
I followed ' "Invalid number" error using Interactive Report search on collection' thread and accordingly
1) Purged User preferences and session state.
2) Cleared browser settings and cache.
3) Deleted old region and Created a new region on the page with the same query.
If I select a column and search it works fine but when I just give an arrangement id which looks like 'ARR12345' directly in search bar it throws Invalid Number.
This is working perfectly fine in other environments which is replica of this one.
I also ran Apex util function to remove sort preferences.
Also my report is a very simple report like select * from a,b where a.id = b.id.
Please help me. This is a production issue.
Thanks a lot in advance.
Regards
Garima
Edited by: 860249 on Nov 4, 2011 11:40 AMUPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'SELECT * FROM sys.v_$reserved_words;
SQL> create table test1(as varchar2(10));
create table test1(as varchar2(10))
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1(sno number, date date);
create table test1(sno number, date date)
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1("as" varchar2(10));
Table created.
SQL>
SQL> create table test2(sno number, "date" date);
Table created.
SQL> desc test1
Name Null? Type
as VARCHAR2(10)
SQL> desc test2
Name Null? Type
SNO NUMBER
date DATE
SQL> -
Error : invalid number error
Hi,
I am using quary in to insert value but show me invalid number.
SELECT 'C/' || :P2_MARKET_CODE|| '/' || TO_CHAR (:P2_START_DATE, 'YYMM')|| '/' INTO v_new_costing_code FROM DUAL;show me invalid number error.
how to resolve this error.
Thanks
Edited by: 805629 on Mar 6, 2011 9:35 PMHi,
Just try this SQL Query.
SELECT 'C/' || :P2_MARKET_CODE|| '/' || TO_CHAR (TO_DATE(:P2_START_DATE, 'DD-MON-YY'), 'MMYY')|| '/' FROM DUAL;
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1
Edited by: Kartik Patel on Mar 7, 2011 11:53 AM -
TO_NUMBER getting invalid number error
I want to use TO_NUMBER function to converse some float number,
but the following query always gets invalid number error:
select to_number('12.1073') from dual;
but if I add the format in, it runs as expected:
select to_number('12.1073', '99.9999') from dual;
From the syntax, the format parameter is optional, is it only optional for integers?
Thanks!Same here.
So, or you replace dot by comma, or you change the territory (or nls_numeric_characters) defined for your session :
SQL> select to_number('12.1073') from dual;
select to_number('12.1073') from dual
ERROR at line 1:
ORA-01722: invalid number
Elapsed: 00:00:00.00
SQL> alter session set nls_territory='america';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
TO_NUMBER('12.1073')
12.1073
Elapsed: 00:00:00.00
SQL> alter session set nls_territory='france';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
select to_number('12.1073') from dual
ERROR at line 1:
ORA-01722: invalid number
Elapsed: 00:00:00.00
SQL> alter session set nls_numeric_characters='.,';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
TO_NUMBER('12.1073')
12.1073
Elapsed: 00:00:00.00
SQL> Nicolas. -
Please help getting invalid number error.
Hi Experts,
My requirement is
If DT_ID value of xmlmsg existed in the DT_ID of PART_ID_COLLES table then that record should be processd else should be skipped.
And xmlmsg of PART_ID should start with "A" and followed only by the number then that record should be processed else should be skipped.
And xmlmsg of DD_DAYS should contain only the number and grater than or equal to 0 ,then that record should be processed else should be skipped.
For that I have written this code.
But if I pass dt_id as string value in xmlmsg I am getting invalid number error.
DT_ID of PART_ID_COLLES table is number data type.
SELECT xmlmsg.part_id part_id,xmlmsg.dd_days dd_days,xmlmsg.dt_id dt_id
FROM XMLTABLE(
XMLNAMESPACES(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/z:row[not(@dt_id=following-sibling::z:row/@dt_id and @part_id=following-sibling::z:row/@part_id)]'
PASSING p_dd_days_vals
COLUMNS
ITEM_NO for ordinality
, dt_id VARCHAR2 (20) path '@dt_id'
, part_id VARCHAR2 (25) path '@part_id'
, dd_days VARCHAR2 (20) path '@dd_days'
) xmlmsg,
part_id_colles pic
WHERE REGEXP_REPLACE(TRIM(xmlmsg.dt_id),'^([0-9]+)$|.','\1') = pic.dt_id
AND REGEXP_LIKE (UPPER(TRIM(xmlmsg.part_id)),'^[A][0-9]+$')
AND (TO_NUMBER(REGEXP_REPLACE(TRIM(xmlmsg.dd_days),'^([0-9]+)$|.','\1')) >=0
AND REGEXP_LIKE(TRIM(xmlmsg.dd_days), '^-?[[:digit:],.]*$') ;
Sample message is
<MESSAGES>
<MESSAGE ID="12345">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
<MSG>
<WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
<WORK_UNIT GROUP="dd_days" ACTION="ADD" AFFECTED="dd_days">
<RECORDSET TABLE_NAME="dd_days">
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
<z:row dt_id="430" part_id="A5556689" dd_days="10"/>
<z:row dt_id="550A" part_id="A8889965" dd_days="20"/>
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>
Please help me.
Thanks.Your code has ton of errors. Anyway:
with part_id_colles as (
select 430 dt_id,xmltype('<MESSAGES>
<MESSAGE ID="12345">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
<MSG>
<WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
<WORK_UNIT GROUP="dd_days" ACTION="ADD" AFFECTED="dd_days">
<RECORDSET TABLE_NAME="dd_days">
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
<z:row dt_id="430" part_id="A5556689" dd_days="10"/>
<z:row dt_id="550A" part_id="A8889965" dd_days="20"/>
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>') p_dd_days_vals from dual)
SELECT xmlmsg.part_id part_id,
xmlmsg.dd_days dd_days,
xmlmsg.dt_id dt_id
FROM part_id_colles pic,
XMLTABLE(
XMLNAMESPACES(
'urn:schemas-microsoft-com:rowset' as "rs",
'#RowsetSchema' as "z"
'/MESSAGES/MESSAGE/MSG/WORK_SET/WORK_UNIT/RECORDSET/xml/rs:data/z:row[not(@dt_id=following-sibling::z:row/@dt_id and @part_id=following-sibling::z:row/@part_id)]'
PASSING p_dd_days_vals
COLUMNS
ITEM_NO for ordinality,
dt_id VARCHAR2 (20) path '@dt_id',
part_id VARCHAR2 (25) path '@part_id',
dd_days VARCHAR2 (20) path '@dd_days'
) xmlmsg
WHERE REGEXP_REPLACE(TRIM(xmlmsg.dt_id),'^([0-9]+)$|.','\1') = pic.dt_id
AND REGEXP_LIKE(UPPER(TRIM(xmlmsg.part_id)),'^[A][0-9]+$')
AND TO_NUMBER(REGEXP_REPLACE(TRIM(xmlmsg.dd_days),'^([0-9]+)$|.','\1')) >=0
AND REGEXP_LIKE(TRIM(xmlmsg.dd_days), '^-?[[:digit:],.]*$')
PART_ID DD_DAYS DT_ID
A5556689 10 430
SQL>
SY.
Maybe you are looking for
-
Resrticting Goods receipt based on cost centre in EBP Version 2.0
Hi, I am working with EBP2.0 version & I need to know whether I can restrict the GR with ref. to cost centre in EBP. (ie. Receive any order functionality. We have not defaulted any cost centre & the user will enter the cost centre & GL a/c at the tim
-
I have a mid 2007 MacBook Pro with 2GB of RAM and NVIDIA GeForce 8600M graphics card. Is it possible to upgrade the RAM and the graphics card?
-
Parameter not showing in Active parameter List.
Dear Team, I have fresh Install SAP 4.7 with sql 200 on Windows 2000 server. After proper installation .I have activate the Profile. When I Edit the parameter via RZ10 and then add new paramer i.e Login/no_automatic_user_sapsta 1 Proper save .The
-
I am trying to sync my iphone 4s to my windowns Itunes account. When i try to do it, the sync wants to remove all of the content on my phone and replace it with what is on my laptop, which has nothing yet. I am trying to move all of my purchased an
-
I have downloaded a number of audiobooks, but they are appearing within my song list. Even if a select shuffle songs only, I get them popping up. Any ideas where I am going wrong.