Invalid Month error in PL/SQL
Hi,
The below query if given without the -- lines at an SQL prompt with work fine. But when used with in a PL/SQL will not work. It throws:
sqlcode: -1843,sqlerrm: ORA-01843: not a valid month error.
SELECT
to_char(wk_beg_d,'dd/mm/yyyy'),to_char(wk_end_d,'dd/mm/yyyy')
-- INTO
-- v_fis_wk_strt_d,
-- v_fis_wk_end_d
FROM
acct_date
WHERE
acct_d = '12-APR-07;
Any suggestions will be very helpful.
Thanks,
Ravi.
It reall depends on what you will be doing with v_fis_wk_strt_d and v_fis_wk_end_d.
If you are just going to display them, and need to have that format for display purposes, then
DECLARE
v_fis_wk_strt_d VARCHAR2(11);
v_fis_wk_end_d VARCHAR2(11);
BEGIN
SELECT TO_CHAR(wk_beg_d,'dd/mm/yyyy'), TO_CHAR(wk_end_d,'dd/mm/yyyy')
INTO v_fis_wk_strt_d, v_fis_wk_end_d
FROM acct_date
WHERE acct_d = TO_DATE('12-APR-2007', 'dd-mon-yyyy');
END;If you are need to use them later as "real" dates, then, as Boneist suggested:
DECLARE
v_fis_wk_strt_d DATE;
v_fis_wk_end_d DATE;
BEGIN
SELECT wk_beg_d, wk_end_d
INTO v_fis_wk_strt_d, v_fis_wk_end_d
FROM acct_date
WHERE acct_d = TO_DATE('12-APR-2007', 'dd-mon-yyyy');
END;John
Similar Messages
-
Invalid month error sometimes in SQL Developer
Hi
sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
But when I dosconnect session and reconnect, It works fine
Any suggestions on how to avoid this issue ?
Thanks872202 wrote:
Hi
sometimes I get 'Invalid Month error' in SQL developer when I execute the following query
select TRUNC(TO_DATE('01-JUN-2013','DD-MON-YYYY')) from dual;
But when I dosconnect session and reconnect, It works fine
Any suggestions on how to avoid this issue ?
ThanksThere's absolutely no reason that that should result in that error.
The SQL is sent to the database and it's perfectly valid SQL, taking a string, and converting it to a date with the correct date format mask, and then truncating the date (which, by default is to the day, which in this case is pointless as it's already truncated), returning a DATE datatype, which SQL Developer will then render using it's date display format. -
Strange invalid month error.
Hi all,
I have a function which receives a date and then returns a text string saying what day of the week it is, ie Monday Tuesday etc etc
For example sakes I'll say the function is called dayoftheweek and we use the function like 'select somedate, dayoftheweek(somedate) from dual'
Now, the bit within the function that works out the day is as below
SELECT TO_CHAR(TO_DATE(p_date, 'DD/MM/RRRR') ,'DAY') from dual (p_date is the internal function variable for the date passed in.)
Now, if I do this
select dayoftheweek('25-MAY-09') from dual -- this works.
But...
select dayoftheweek('25/05/09') from dual -- this does not work, I get an ora 01843 invalid month error.
So, I assumed it was something to do with the logic that worked out the day of the week.
However, the below works.
SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dual
Does anyone know why when passing a date to the function in format 'select dayoftheweek('25/05/09') from dual' does not work but if I use this format within the function logic as above it does work?
Cheers,
rgHello,
Oracle does not know your date format:
select dayoftheweek('25/05/09')I.e, it does not know that the date you are passing in is in the form of 'DD/MM/MM'. You must tell it (since it isn't your default format):
select dayoftheweek(to_date('25/05/09', 'DD/MM/YY'))If all you wanted, however, was the day of the week from a date, then:
TO_CHAR(to_date('25/05/09', 'DD/MM/YY'), 'DAY')Will give you that.
And by the way, this:
SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR') ,'DAY') from dualIs correct by chance, even though you're getting no error you may get the wrong result, because you're telling oracle you're passing in 4 digits for the year, yet you're only passing in two.
Edit Beware:
SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/RRRR'), 'YYYY') from dual;
TO_C
2009
SQL> SELECT TO_CHAR(TO_DATE('25/05/09', 'DD/MM/YYYY'), 'YYYY') from dual;
TO_C
0009 -
Invalid month error in WEBI report level
Hi,
I had a issue with date format.I am using oracle10g as a backend database.I have a date object in universe level i used that object in web intelligence report level.I created prompt for date object after select the date from the list i am getting " invalid month error". In database level object datatype is timestamp.
How to solve this issue.can somebody help me to solve the problem.Hi
Date Objects depends on various formats for different database
Make sure that u format date like MM/dd/yyyy in universe level . and the object should be in date datatype .
In the query level use prompt to select dates.
In report level
create a variable and use a formula like
todate(userresponse("Enter date");"")
Hope this helps U
Sunil -
Invalid Package error (limits?) - SQL*Loader
I seem to have reached a limit on SQL*Loader in 8.1.6 on the number of columns I am trying to load. The table has 97 columns - if I try to specify more than 92 columns I get an invalid package error - it doesn't matter which column I pick. The row width is close to 2K bytes. Does anyone know the max size - and is there a default that can be increased somehow?
It maybe your BUFFER size.
Buffer Size = Rows in Array * Max row size
this is the formula to estimate your BUFFER size for the import.
Look in your Parameter File for 'INCTYPE' this is the parameter name for Buffer for importing with SQL*Loader.
Hope this helps.
Tony -
I have seen a thread on this topic. But my issue is a bit different.
I have a table (suppose A) with a date column (let b B)
There is a view on this table say A_V. This view simply queries the table A.
I have another table C, to which I am inserting record from A_V in a for loop like
FOR i IN (SELECT * FROM A_V)
LOOP
INSERT INTO C(x,y,B)
VALUES( i.x,i.y,nvl(i.B,sysdate) );
END LOOP;
I found invalid month issue in it. I am not sure of the reason. However, do I need apply to_char on i.B or nvl(i.B,sysdate) to give it a specific format. And if so, how would I know what format I should apply.
I was also doing some test plsql developer and found result like this. Can anyone help me understand.
select id,nvl(to_char(DATE_DATA,'dd/MM/yyyy'),to_date('19000101','YYYYMMDD')) from DATA_DUMP
where DATE_DATA is null
result is
1 361725 01-JAN-00
2 800001 01-JAN-00
3 800002 01-JAN-00
4 420068 01-JAN-00
5 442682 01-JAN-00
6 442984 01-JAN-00
7 442340 01-JAN-00
select id,nvl(DATE_DATA,to_date('19000101','YYYYMMDD')) from DATA_DUMP
where DATE_DATA is null
1 361725 1/1/1900
2 800001 1/1/1900
3 800002 1/1/1900
4 420068 1/1/1900
5 442682 1/1/1900
6 442984 1/1/1900
7 442340 1/1/1900
I get similar result with DATA_DATA not null too.
-Debp.s. you also don't need to do your insert as single inserts within a cursor loop as this will give you poor performance. It should be done as a single insert... select... statement.
e.g.
SQL> select * from a;
EMPNO DEPTNO B
7369 20 17/12/1980 00:00:00
7499 30 20/02/1981 00:00:00
7521 30 22/02/1981 00:00:00
7566 20 02/04/1981 00:00:00
7654 30 28/09/1981 00:00:00
7698 30 01/05/1981 00:00:00
7782 10 09/06/1981 00:00:00
7788 20
7839 10 17/11/1981 00:00:00
7844 30 08/09/1981 00:00:00
7876 20
7900 30 03/12/1981 00:00:00
7902 20 03/12/1981 00:00:00
7934 10 23/01/1982 00:00:00
14 rows selected.
SQL> create table c (empno number, deptno number, b date);
Table created.
SQL> insert into c
2 select empno, deptno, nvl(b,sysdate)
3 from a;
14 rows created.
SQL> select * from c;
EMPNO DEPTNO B
7369 20 17/12/1980 00:00:00
7499 30 20/02/1981 00:00:00
7521 30 22/02/1981 00:00:00
7566 20 02/04/1981 00:00:00
7654 30 28/09/1981 00:00:00
7698 30 01/05/1981 00:00:00
7782 10 09/06/1981 00:00:00
7788 20 09/01/2009 15:24:04
7839 10 17/11/1981 00:00:00
7844 30 08/09/1981 00:00:00
7876 20 09/01/2009 15:24:04
7900 30 03/12/1981 00:00:00
7902 20 03/12/1981 00:00:00
7934 10 23/01/1982 00:00:00
14 rows selected.
SQL> -
Invalid month error during import
I have set NLS_DATE_FORMAT=”YYYY-MM-DD HH24:MI:SS’ in my import script, yet I get following error in import. I tried NLS_DATE_FORMAT=”RRRR-MM-DD HH24:MI:SS” as well, yet get same error. How can I get rid of the error.
I am on Oracle 10.2.0.4 on HP UNIX.
" ALTER TABLE "IN_ERM_SPOOL" MODIFY ("REPORT_TIME" DEFAULT '1970-01-01 00:00"
":00' )"
IMP-00003: ORACLE error 1843 encountered
ORA-01843: not a valid month
IMP-00017: following statement failed with ORACLE error 1843:
" ALTER TABLE "IN_EXTERN_MSG" MODIFY ("START_TIME" DEFAULT '1970-01-01 00:00"
":00' )"
IMP-00003: ORACLE error 1843 encountered
ORA-01843: not a valid monthThat was a typo. Double quotes are needed in shell script.I am sorry to see that COPY & PASTE is broken for you.
Post results of
SELECT * from v$version;
I am NOT convinced that setting OS environmental variable has the desire results
bcm@bcm-laptop:~$ export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
bcm@bcm-laptop:~$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Sat Nov 20 19:52:55 2010
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select sysdate from dual;
SYSDATE
20-NOV-10
SQL> alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
Session altered.
SQL> select sysdate from dual;
SYSDATE
2010-11-20 20:17:34
SQL> -
Invalid Month error in stored procedure
Hello, I have a simple stored procedure that I pass a begin and end date into and it is complaining about the date formatting. Below is the table layout and stored procedure in question. How can I format the date for example as MM-DD-YYYY and not have it complain? I have tried using TO_DATE and TO_CHAR and it still complains.
Thank you.
-- Table
CREATE TABLE INV_MOVE_ARCHIVE
*( "RETAILER_ID" NUMBER NOT NULL,*
*"SKU_ID" VARCHAR2(18 BYTE) NOT NULL,*
*"OUTLET_ID" VARCHAR2(20 BYTE) NOT NULL,*
*"QTY_CHANGE" NUMBER NOT NULL,*
*"TRANS_DATE" DATE DEFAULT sysdate*
-- Stored procedure
CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN INT)
IS
skuId VARCHAR(18);
outletId VARCHAR(20);
qtyChange INTEGER;
-- Declaring the cursor
CURSOR getInvRecord IS
SELECT
sku_id,
outlet_id,
qty_change
INTO
skuId,
outletId,
qtyChange
FROM
inv_move_archive
WHERE
retailer_id = retailerId AND
trans_date >= beginDate AND
trans_date <= endDate;
BEGIN
FOR rec_getInvRecord IN getInvRecord LOOP
UPDATE OUTLET_SKU_XREF
SET qty = qty + qtyChange
WHERE outlet_id = outletId
AND sku_id = skuId;
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
IF getInvRecord%isopen THEN CLOSE getInvRecord;
END IF;
END inv_move_update;
*/*Okay, I do not wantto change the table. I believe thatthe Java developers will need to change their code to call this procedure correctly. Another iss I am having is when I call this procedure manually from the database is is NOT doing the update. I put some debug statements in it and they indicate that the update statement is NOT updating any rows. If I run the select statement that is in the sp using the same parameters I pass into the sp it comes back with 1 row. The row to be updated is present in the table being updated.
-- Here is my sp call
DECLARE
BEGINDATE DATE;
ENDDATE DATE;
RETAILERID NUMBER;
BEGIN
BEGINDATE := to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS');
ENDDATE := to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS');
RETAILERID := 104;
INV_MOVE_UPDATE(
BEGINDATE => BEGINDATE,
ENDDATE => ENDDATE,
RETAILERID => RETAILERID
END;
-- Select statement with same values
SELECT
sku_id,
outlet_id,
qty_change
FROM
inv_move_archive
WHERE
retailer_id = 104 AND
trans_date >= to_date('01/07/2009 00:00:00', 'MM/DD-YYYY HH24:MI:SS') AND
trans_date <= to_date('01/07/2009 11:59:59', 'MM/DD-YYYY HH24:MI:SS')
-- Results from select
036266579804040 9900165 500
-- Here is the procedure with the debug statements in it.
CREATE OR REPLACE PROCEDURE inv_move_update(beginDate IN DATE, endDate IN DATE, retailerId IN INT)
IS
skuId VARCHAR(18);
outletId VARCHAR(20);
qtyChange NUMBER;
errorMessage VARCHAR(2500) := NULL;
-- Declaring the cursor
CURSOR getInvRecord IS
SELECT
sku_id,
outlet_id,
qty_change
INTO
skuId,
outletId,
qtyChange
FROM
inv_move_archive
WHERE
retailer_id = retailerId AND
trans_date >= beginDate AND
trans_date <= endDate;
BEGIN
FOR rec_getInvRecord IN getInvRecord LOOP
DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
UPDATE OUTLET_SKU_XREF
SET qty = qty + qtyChange
WHERE outlet_id = outletId
AND sku_id = skuId;
DBMS_OUTPUT.PUT_LINE('SKUID: ' || skuId);
DBMS_OUTPUT.PUT_LINE('Rows Updated: ' || SQL%ROWCOUNT);
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
errorMessage := 'Error updating the OUTLET_SKU_XREF table: ' || SQLCODE || ':' || SQLERRM;
RAISE_APPLICATION_ERROR(-20001,errorMessage);
DBMS_OUTPUT.PUT_LINE(errorMessage);
IF getInvRecord%isopen THEN CLOSE getInvRecord;
END IF;
END inv_move_update;
/I get no errors when running it. The DBMS_OUTPUT shows null for the skuId and 0 for Rows Updated. Like I said I ran the select manually and it returns a row and I see that the row does exist in the target table. Any ideas what is going on here?
Thank you
-- David -
Dynamic SQL Issue ORA-00904:invalid identifier error
Here is my SP
create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
p_ref_cur out PK_FR_TYPES.cursor_type) is
query_str varchar2(5000);
begin
query_str := 'SELECT * FROM dw_county where county_name = :P ';
open p_ref_cur for query_str USING p_county_code;
insert into srini_query_str_test values (query_str);
commit;
end srini_ref_cursor_test;
When I pass the p_county_code = Adams working find.
create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
p_ref_cur out PK_FR_TYPES.cursor_type) is
query_str varchar2(5000);
begin
query_str := 'SELECT * FROM dw_county where county_name in ('||p_county_code||')';
open p_ref_cur for query_str;
insert into srini_query_str_test values (query_str);
commit;
end srini_ref_cursor_test;
When I pass the p_county_code = Adams for above SP I got the following error
ORA-00904: "ADAMS": invalid identifier error
With out Bind variables how Can I pass the Char type values in Dynamic SQL ?
I would like to pass multipule values to p_county_code like 'Adams','Ashley' etc
How Can I do this ?
Thank for great help.
SriniHow do I write the Dynamic SQL for
SELECT * FROM DW_COUNTY WHERE COUNTY_NAME LIKE 'Ad%'
The usual way...
hr@ORA10G>
hr@ORA10G> var str varchar2(1000);
hr@ORA10G> var cr refcursor;
hr@ORA10G>
hr@ORA10G> exec :str := 'select * from employees where first_name like ''A%''';
PL/SQL procedure successfully completed.
hr@ORA10G> -- note the escape character for each single quote
hr@ORA10G> print str
STR
select * from employees where first_name like 'A%'
hr@ORA10G>
hr@ORA10G> exec open :cr for :str;
PL/SQL procedure successfully completed.
hr@ORA10G> print cr
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
103 Alexander Hunold AHUNOLD 590.423.4567 03-JAN-90 IT_PROG 9000 102 60
115 Alexander Khoo AKHOO 515.127.4562 18-MAY-95 PU_CLERK 3100 114 30
121 Adam Fripp AFRIPP 650.123.2234 10-APR-97 ST_MAN 8200 100 50
147 Alberto Errazuriz AERRAZUR 011.44.1344.429278 10-MAR-97 SA_MAN 12000 .3 100 80
158 Allan McEwen AMCEWEN 011.44.1345.829268 01-AUG-96 SA_REP 9000 .35 146 80
167 Amit Banda ABANDA 011.44.1346.729268 21-APR-00 SA_REP 6200 .1 147 80
175 Alyssa Hutton AHUTTON 011.44.1644.429266 19-MAR-97 SA_REP 8800 .25 149 80
185 Alexis Bull ABULL 650.509.2876 20-FEB-97 SH_CLERK 4100 121 50
187 Anthony Cabrio ACABRIO 650.509.4876 07-FEB-99 SH_CLERK 3000 121 50
196 Alana Walsh AWALSH 650.507.9811 24-APR-98 SH_CLERK 3100 124 50
10 rows selected.
hr@ORA10G>
hr@ORA10G>pratz -
SP 2013 Server + Dec 2013 CU. Upgrading from SharePoint 2010.
We have a web application that is distributed over 7-8 content databases from SharePoint 2010. All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.
while running Test-SPContentDatabase or Mount-SPContentDatabase.
EventViewer has the following reporting 5586 event Id:
Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.Invalid object name 'Webs'.
After searching a bit, these links do not help:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/fd020a41-51e6-4a89-9d16-38bff9201241/invalid-object-name-webs?forum=sharepointadmin
we are trying PowerShell only.
http://blog.thefullcircle.com/2013/06/mount-spcontentdatabase-and-test-spcontentdatabase-fail-with-either-invalid-object-name-sites-or-webs/
In our case, these are content databases. This is validated from Central Admin.
http://sharepointjotter.blogspot.com/2012/08/sharepoint-2010-exception-invalid.html
Our's is SharePoint 2013
http://zimmergren.net/technical/findbestcontentdatabaseforsitecreation-problem-after-upgrading-to-sharepoint-2013-solution
Does not seem like the same exact problem.
Any additional input?
Thanks, Soumya | MCITP, SharePoint 2010Hi,
“All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.”
Did the sentence you mean only one database not upgrade to SharePoint 2013 and given the error?
One or more of the following might be the cause:
Insufficient SQL Server database permissions
SQL Server database is full
Incorrect MDAC version
SQL Server database not found
Incorrect version of SQL Server
SQL Server collation is not supported
Database is read-only
To resolve the issue, you can refer to the following article which contains the causes and resolutions.
http://technet.microsoft.com/en-us/library/ee513056(v=office.14).aspx
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support -
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 SontiHello,
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 -
Given query giving an error -invalid month????
select to_date(add_months(trunc(sysdate),-5) ||' 10:30:00 AM','mm/dd/yyyy hh:mi:ss am') from dual
giving an error-invalid month..1. Instead of comma you have put dot.
2. Below is teh correct usage
select to_date(to_char(add_months(trunc(sysdate),-5),'DD/MM/YYYY')||' 10:30:00 AM','DD/MM/YYYY HH:MI:SS AM')
from dual3. But, why are you going for this when there is a straight forward way? -
Invalid query tree 300-33 - SQL Error 8180 @ Query
Hello,
@ my Grid i geht the error Invalid query tree 300-33 - SQL Error 8180 @ the Select Statement.
oGrid= ( ( SAPbouiCOM.Grid)(oItem.Specific));
oForm.DataSources.DataTables.Add("myGrid");
oForm.DataSources.DataTables.Item(0).ExecuteQuery("select U_NAG_CardCode, U_NAG_CardName, U_NAG_ProjName, U_NAG_ProjNr, U_NAG_ProjAbge, U_NAG_ProjStart from SBODemoDE.dbo.NAG_PROJEKTEE");
oGrid.DataTable = oForm.DataSources.DataTables.Item("myGrid");
I dont know what´s wrong.
When i execute this in SQL-Managmant Studio , it works.
pls Help
Thanks
DhomasHi Dhomas,
How did you solve this problem? I have the same and need some help.
regards
Ela -
I am using DBMS_XMLParser in Oracle 10g to parse an XML. The code is as follows:
CREATE OR REPLACE procedure xml_main is
P DBMS_XMLPARSER.Parser;
DOC CLOB;
v_xmldoc DBMS_XMLDOM.DOMDocument;
v_out CLOB;
BEGIN
P := DBMS_XMLPARSER.newParser;
DBMS_XMLPARSER.setValidationMode(p, FALSE);
DOC := '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<com.welligent.Student.BasicStudent.Create>
<ControlAreaSync messageCategory="com.welligent.Student" messageObject="BasicStudent" messageAction="Create" messageRelease="1.0" messagePriority="1" messageType="Sync">
<Sender>
<MessageId>
<SenderAppId>com.openii.SyncRouter</SenderAppId>
<ProducerId>a72af712-90ea-43be-b958-077a87a29bfb</ProducerId>
<MessageSeq>53</MessageSeq>
</MessageId>
<Authentication>
<AuthUserId>Router</AuthUserId>
</Authentication>
</Sender>
<Datetime>
<Year>2001</Year>
<Month>3</Month>
<Day>23</Day>
<Hour>13</Hour>
<Minute>47</Minute>
<Second>30</Second>
<SubSecond>223</SubSecond>
<Timezone>6:00-GMT</Timezone>
</Datetime>
</ControlAreaSync>
<DataArea>
<NewData>
<BasicStudent mealCode="" usBorn="Yes" migrant="No" workAbility="No" ellStatus="">
<StudentNumber>052589F201</StudentNumber>
<ExternalIdNumber>1234567890</ExternalIdNumber>
<StateIdNumber>123456</StateIdNumber>
<Name>
<LastName>Lopez</LastName>
<FirstName>Maria</FirstName>
<MiddleName>S</MiddleName>
</Name>
<Gender>Female</Gender>
<BirthDate>
<Month>1</Month>
<Day>1</Day>
<Year>1995</Year>
</BirthDate>
<Race>Hispanic</Race>
<Ethnicity>Hispanic</Ethnicity>
<PrimaryLanguage>English</PrimaryLanguage>
<HouseholdLanguage>Spanish</HouseholdLanguage>
<Address>
<Street>123 Any Street</Street>
<ApartmentNumber>12-D</ApartmentNumber>
<City>Los Angeles</City>
<County>Los Angeles</County>
<State>CA</State>
<ZipCode>90071</ZipCode>
</Address>
</BasicStudent>
</NewData>
</DataArea>
</com.welligent.Student.BasicStudent.Create>';
DBMS_XMLPARSER.PARSECLOB ( P, DOC );
v_xmldoc := DBMS_XMLPARSER.getDocument(P);
printElementAttributes(v_xmldoc);
exception
when DBMS_XMLDOM.INDEX_SIZE_ERR then
raise_application_error(-20120, 'Index Size error');
when DBMS_XMLDOM.DOMSTRING_SIZE_ERR then
raise_application_error(-20120, 'String Size error');
when DBMS_XMLDOM.HIERARCHY_REQUEST_ERR then
raise_application_error(-20120, 'Hierarchy request error');
when DBMS_XMLDOM.WRONG_DOCUMENT_ERR then
raise_application_error(-20120, 'Wrong doc error');
when DBMS_XMLDOM.INVALID_CHARACTER_ERR then
raise_application_error(-20120, 'Invalid Char error');
when DBMS_XMLDOM.NO_DATA_ALLOWED_ERR then
raise_application_error(-20120, 'Nod data allowed error');
when DBMS_XMLDOM.NO_MODIFICATION_ALLOWED_ERR then
raise_application_error(-20120, 'No mod allowed error');
when DBMS_XMLDOM.NOT_FOUND_ERR then
raise_application_error(-20120, 'Not found error');
when DBMS_XMLDOM.NOT_SUPPORTED_ERR then
raise_application_error(-20120, 'Not supported error');
when DBMS_XMLDOM.INUSE_ATTRIBUTE_ERR then
raise_application_error(-20120, 'In use attr error');
END;
CREATE OR REPLACE procedure printElementAttributes(doc DBMS_XMLDOM.DOMDocument) is
nl DBMS_XMLDOM.DOMNODELIST;
len1 NUMBER;
len2 NUMBER;
n DBMS_XMLDOM.DOMNODE;
e DBMS_XMLDOM.DOMELEMENT;
nnm DBMS_XMLDOM.DOMNAMEDNODEMAP;
attrname VARCHAR2(100);
attrval VARCHAR2(100);
text_value VARCHAR2(100):=NULL;
n_child DBMS_XMLDOM.DOMNODE;
BEGIN
-- get all elements
nl := DBMS_XMLDOM.getElementsByTagName(doc, '*');
len1 := DBMS_XMLDOM.getLength(nl);
-- loop through elements
FOR j in 0..len1-1 LOOP
n := DBMS_XMLDOM.item(nl, j);
e := DBMS_XMLDOM.makeElement(n);
DBMS_OUTPUT.PUT_LINE(DBMS_XMLDOM.getTagName(e) || ':');
-- get all attributes of element
nnm := DBMS_XMLDOM.getAttributes(n);
n_child:=DBMS_XMLDOM.getFirstChild(n);
text_value:=DBMS_XMLDOM.getNodeValue(n_child);
dbms_output.put_line('val='||text_value);
IF (DBMS_XMLDOM.isNull(nnm) = FALSE) THEN
len2 := DBMS_XMLDOM.getLength(nnm);
dbms_output.put_line('length='||len2);
-- loop through attributes
FOR i IN 0..len2-1 LOOP
n := DBMS_XMLDOM.item(nnm, i);
attrname := DBMS_XMLDOM.getNodeName(n);
attrval := DBMS_XMLDOM.getNodeValue(n);
dbms_output.put(' ' || attrname || ' = ' || attrval);
END LOOP;
dbms_output.put_line('');
END IF;
END LOOP;
END printElementAttributes;
While executing the xml_main proc from an anonymous block, I am getting the following error:
ORA-04063: package body "XDB.DBMS_XMLPARSER" has errors
ORA-06508: PL/SQL: could not find program unit being called: "XDB.DBMS_XMLPARSER"
ORA-06512: at "BALB.XML_MAIN", line 9
ORA-06512: at line 2
I've checked that the XDB is installed in my database by running the below query and getting the output
select comp_name, version, status
from dba_registry
where comp_name like '%XML%';
COMP_NAME VERSION STATUS
Oracle XML Database 10.2.0.2.0 VALID
1 row selected.
Please let me know a way out to resolve it?It worked for me. I ran your code fine in Oracle 10g. Now 9i is probably a different story.
-
Invalid prompt Error in derived table
hello All,
I have the below query which works in SQL server...but the same query in derived table is giving invalid prompt error when instead of hardcoding the value...I gave @prompt for user input value.
SELECT
convert(varchar(6), dateadd(MM,-3, convert(datetime, substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 5,2) + '/' + '30' + '/'+ substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 1,4))), 112) as prequarter,
Primed_Status,
EHR
FROM
EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE
where RPT_YEAR_MONTH = '201406'
SELECT
convert(varchar(6), dateadd(MM,-3, convert(datetime, substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 5,2) + '/' + '30' + '/'+ substring(cast(EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE.RPT_YEAR_MONTH as varchar), 1,4))), 112) as prequarter,
Primed_Status,
EHR
FROM
EMR_REPORTING.dbo.vMH_MEASURE_PRACTICE
where RPT_YEAR_MONTH = @Prompt('Enter values for Rpt Year Month:','N','Folder\MeasurePractice\Rpt Year Month',Mono,Constrained)
Thanks in advance for any inputs.
Regards.Please check the Prompt definition and whether you are entering all the parameters in the prompt syntax. As I could see there are only 5 parameters there in your prompt definitions
Maybe you are looking for
-
It should be possible to set default behavior for all file types
It should be possible to set a default action for all file types. I'm so tired of having to manually sit and say "save this file" because Firefail always defaults to "open with" and has disabled the "Do this automatically for files like this from now
-
Macbook 2009 screen going black randomly
My macbook 5,2 circa about autumn 2009 (white plastic) keeps randomly going to black screen whether or not the power cable is plugged in. I've reset the SMC but no improvement. It sounds like the fan is running all the time too - and when the scree
-
Please read this. http://macteens.com/forums/index.php?showtopic=9368&st=0 This is about my mac, to take or not to take in for service? Can I fix this on my own?
-
How to Hide Report Background Engine
Hi, can you help me on my problem. What should I do, to hide the Report Background Engine when the report is running. Thanks in advance! Eric null
-
Trying to account for dozens of unidentified TB on SSD
I am working with a late 2009 27" 2.66Ghz iMac running OS X 10.9.3 It is fitted with 16GB RAM. the Operating system and applications are on a 240Gb OWC 3G SSD. Issue: When I go to SSD > users > user name and use the 'get info" tool it tells me that