ORA-00932: inconsistent data types: expected NUMBER obtained DATE
Hi all
I have problem in the creation of report of the foregoing, it is can someone help me in this.
Here is the code
-------------------------
Select ar_tab.account_number,
ar_tab.party_name,
ar_tab.trans_type,
ar_tab.trans_type_name,
ar_tab.invoice_currency_code,
ar_tab.trx_num,
ar_tab.trans_date,
ar_tab.gl_date,
ar_tab.due_date,
(nvl (ar_tab.fcy_amt, 0) - nvl (ar_tab.ar_fcy_amt_due, 0)) outstanding_amount,.
(case when trunc(:p_to_date) - trunc (ar_tab.trans_date) < = 0 then (ar_tab.inr_amt - ar_tab.ar_acctd_amt_due) end else 0) current_bal
of (hca.account_number select account_number,)
Party_name HP.party_name,
CTA.customer_trx_id customer_trx_id,-, acl.name, collector_name
Decode (ps.class,
"INV', 'the Bill."
"MD", "Débit Memo"
"CM", "Credit memo")
trans_type,
rctt. Name trans_type_name,
rctt.cust_trx_type_id cust_trx_type_id,
CTA.invoice_currency_code invoice_currency_code,
Hou.location_code location_code,
PS.trx_number trx_num,
PS.trx_date trans_date,
PS.gl_date gl_date,
PS.due_date end_date,
PS.amount_due_original fcy_amt,
round ((ps.amount_due_original * nvl (ps.exchange_rate, 1)), 2) inr_amt.
PS.exchange_rate exchange_rate,
PS.amount_due_remaining amount_due_remaining_fcy,
PS.acctd_amount_due_remaining amount_remaining_inr,
(select round (sum (nvl (a.amount_applied * nvl (ps.exchange_rate, 1), 0)), 2))
of ar_receivable_applications_all one
where a.applied_payment_schedule_id = ps.payment_schedule_id
-a.APPLIED_CUSTOMER_TRX_ID = ps. CUSTOMER_TRX_ID
and a.display = 'Y '.
and trunc (a.gl_date) between: p_from_date and: p_to_date
Group of a.applied_payment_schedule_id)
ar_acctd_amt_due,
(select round (sum (nvl (a.amount_applied, 0)), 2))
of ar_receivable_applications_all one
where a.applied_payment_schedule_id = ps.payment_schedule_id
and a.display = 'Y '.
and trunc (a.gl_date) between: p_from_date and: p_to_date
Group of a.applied_payment_schedule_id)
ar_fcy_amt_due
of apps.ar_payment_schedules_all ps,.
Apps.hz_cust_accounts AOB,
HP apps.hz_parties,-, acl apps.ar_collectors
Apps.ra_customer_trx_all cta,
Apps.ra_cust_trx_types_all rctt,
hr_organization_units_v hou
where hca.cust_account_id = ps.customer_id
and ps.customer_trx_id = cta.customer_trx_id
and cta.cust_trx_type_id = rctt.cust_trx_type_id
and ps.class <>"LMP".
and hca.account_number = nvl (: p_cust_code, hca.account_number)
and ps.class = nvl (: p_class, ps.class)
and ps.class in ('INV', 'DM')
and cta.invoice_currency_code <>'INR '.
and hou.organization_id = cta.org_id
and cta.org_id = nvl (: p_org_id, cta.org_id)
and hp.party_id = hca.party_id
and ps.invoice_currency_code <>'INR '.
and rctt.org_id = cta.org_id
and ps.amount_adjusted is null - added July 10, 2012
and trunc (ps.gl_date) between nvl (: p_from_date, trunc (ps.gl_date))
and nvl (: p_to_date, trunc (ps.gl_date))) ar_tab
- AND AR_TAB. Amount_Remaining_INR <>0
where (nvl (ar_tab.inr_amt, 0) - nvl (ar_tab.ar_acctd_amt_due, 0)) <>0
OK well understood.
But I asked you the query that you have changed as suggested by me.
I guess you changed your query into a toad and copy then paste into the generator. So I want to check the query how you changed according to my suggestion.
because, I've modified your request and took the new report and inserted, works very well.
Tags: Oracle Development
Similar Questions
-
Hi friends,
I get this error: ORA-00932: inconsistent data types: expected DATE got the NUMBER to the call of the OIC OCIStmtExecute when I'm putting the filter on the date column condition.
"Sun Time". " Day' < = cast (MAX ("Sun time" "." ")) Date day")) and"Sun Time ". "' Day ' > = TIMESTAMPADD (SQL_TSI_MONTH,-1, cast (MAX ("Sun time".) "Day") as date). "
I sank the date max, but if I get the above error. I think max (date) creates the problem.
Please suggest your opinion on that.
Thank you.
Thank you for your suggestions.
I used the variable, and it helped.
"Sun Time". " Date' <= valueof(maxdate)="" and="" "dim-time"."date"="">= TIMESTAMPADD (SQL_TSI_MONTH-1, VALUEOF (Maxdate))
=>
-
-Error ORA-00932: inconsistent data types: expected TANK got the NUMBER
Here is my report query...
The column data type RFA_FLAG is NUMBER(*,0)... I'm view RSA and RSA - not the area of selection, but I get the error ORA-00932: inconsistent data types: expected TANK got the NUMBER >select * from DW_RFA_JOBDATA where FINISH_TIME >= :P1_START_DATE and FINISH_TIME < :P1_END_DATE AND RFA_FLAG = (CASE :P1_JOB_CLASSIFICATION WHEN '0' THEN 'LSF' WHEN '1' THEN 'NON-LSF' ELSE RFA_FLAG END)
I have created a static LOV with LST display 0 return
Display NON - RSA 1 return...
Could any body please help me in truble shooting error? How to to convert the data type to number, I have no privileges to make changes to the table...Mark you my previous answer as correct? (MOST POINTS! :))
-
ADF: ORA-00932: inconsistent data types: expected - got TANK
I get this error while casting. ORA-00932: inconsistent data types: expected - got TANK
I had departments such as front number... .but must be able to take over the alpha characters... so I changed my Bind Variables in my model: Array string (decimal Big)
This is the error:
where dept in (SELECT * FROM TABLE (CAST (: depts AS glc.))) NUMTABTYPE)))
How can I solve this?... probably need to delete interpreters from here... .but how I it... any help is appreciated.
I also Type:
create or replace TYPE NUMTABTYPE in the TABLE to the number; (also I tried to change this option for create or replace TYPE NUMTABTYPE in the TABLE to the varchar2 (200);)
I changed the table to a string and
[oracle.jbo.domain.Number]"with java.lang.String to support also supports departments alpha characters... dept can be AB123 (string) or 3344 (number only)
The entire query
============
SELECT * FROM (SELECT
NVL ("DEPT", "Grand Total") as DEPT,
PERIOD_YEAR,
In summary (round ("Jan real CDA")) 'real Jan CDA. "
In summary (round ("Feb real CDA")) 'Feb CDA real. "
In summary (round ("Mar real CDA")) 'Mar CDA real. "
In summary (round ("Apr CDA")) real 'Real CDA Apr',
In summary (round ("peut CDA")) real "can actual CDA."
In summary (round ("Jun real CDA")) 'Jun CDA real. "
sum (round ("Jul real CDA")) 'Real CDA Jul',
In summary (round ('Aug real CDA")) 'Aug CDA real."
In summary (round ("Ms real CDA")) 'Ms CDA real. "
In summary (round ("Oct real CDA")) 'Oct CDA real. "
In summary (round ("Nov real CDA")) 'real CDA Nov. "
In summary (round ('Dec real CDA")) 'Dec CDA real."
In summary (round ("Jan CDA Budget")) 'Budget of CDA Jan. "
In summary (round ("Feb CDA Budget")) 'Feb CDA Budget. "
In summary (round ("Mar CDA Budget")) 'Mar CDA Budget. "
In summary (round ("Apr CDA Budget")) 'Apr CDA Budget. "
In summary (round ("can CDA Budget")) 'Budget of CDA can. "
In summary (round ("Jun CDA Budget")) 'Jun CDA Budget. "
In summary (round ("Jul CDA Budget")) 'Jul CDA Budget. "
In summary (round ("Aug CDA Budget")) 'Aug CDA Budget. "
In summary (round ("Sep CDA Budget")) 'Ms CDA Budget. "
In summary (round ("Oct CDA Budget")) 'Oct CDA Budget. "
In summary (round ("Nov CDA Budget")) 'Nov CDA Budget. "
In summary (round ("CDA Budget Dec")) 'Dec CDA Budget. "
In summary (round ('Total Budget uncorrected')) "Annual_Budget."
In summary (round ("Total Budget")) "Revised_BUDGET."
sum (round ("real CDA")) "YTD_ACTUALS."
In summary (round ("Jan Actual")) "Jan_ACTUAL."
In summary (round ('Jan Budget')) "Jan_BUDGET."
In summary (round ("Jan Actual")) "JanYTDACTUAL."
In summary (round ('Jan Budget')) "JanYTDBUDGET."
sum (round ("real Feb")) "Feb_ACTUAL."
In summary (round ('Feb Budget')) "Feb_BUDGET."
sum (round ("real Mar")) "Mar_ACTUAL."
In summary (round ("Budget de Mar")) "Mar_BUDGET."
sum (round ("real Apr")) "Apr_ACTUAL."
In summary (round ("Apr Budget")) "Apr_BUDGET."
In summary (round ("can real")) "May_ACTUAL."
In summary (round ("Budget can")) "May_BUDGET."
sum (round ("real Jun")) "Jun_ACTUAL."
In summary (round ('Jun Budget')) "Jun_BUDGET."
sum (round ("real Jul")) "Jul_ACTUAL."
In summary (round ('Jul Budget')) "Jul_BUDGET."
sum (round ("real Aug")) "Aug_ACTUAL."
In summary (round ('Aug Budget')) "Aug_BUDGET."
sum (round ("real Sep")) "Sep_ACTUAL."
In summary (round ('Ms Budget')) "Sep_BUDGET."
sum (round ("real Oct")) "Oct_ACTUAL."
In summary (round ('Oct Budget')) "Oct_BUDGET."
sum (round ("real Nov")) "Nov_ACTUAL."
In summary (round ('Nov Budget')) "Nov_BUDGET."
sum (round ("real Dec")) "Dec_ACTUAL."
In summary (round ("Dec Budget")) "Dec_BUDGET."
sum (round ("Jan Budget" + "Jan Budget Adj")) "Jan_Budget_Orig."
sum (round ("Budget Feb" + "Feb Budget Adj")) "Feb_Budget_Orig."
sum (round ("Mar Budget" + "Mar Budget Adj")) "Mar_Budget_Orig."
sum (round ("Apr Budget" + "After Budget Adj")) "Apr_Budget_Orig."
sum (round ("Budget can" + "Can Budget Adj")) "May_Budget_Orig."
sum (round ("Jun Budget" + "Jun Budget Adj")) "Jun_Budget_Orig."
sum (round ("Jul Budget" + "Jul Budget Adj")) "Jul_Budget_Orig."
sum (round ("Aug Budget" + "August Budget Adj")) "Aug_Budget_Orig."
sum (round ("Ms Budget" + "Ms Budget Adj")) "Sep_Budget_Orig."
sum (round ("Oct Budget" + "Oct Budget Adj")) "Oct_Budget_Orig."
sum (round ("Budget Nov" + "Nov Budget Adj")) "Nov_Budget_Orig."
sum (round ('Dec Budget '' + '' Dec Budget Adj")) 'Dec_Budget_Orig '.
GLC. GLC_BUDANAL_ACT_BUD_ADJ_VAR_V mainanal
where dept in (SELECT * FROM TABLE (CAST (: depts AS glc.))) NUMTABTYPE))) and period_year =: year and substr ("OBJECT", 1, 3). =: excludeObject
and mainanal. FERC not like 4% '
Group by the Department, period_year) QRSLT ORDER BY DEPTAs you say your table does not number but the strings. If you must change the table in an array of strings.
Timo
-
ORA-00932: inconsistent data types: expected - got CURSER
Hi all
I created a function and tried to run SQL Plus, but I get an error
ORA-00932: inconsistent data types: expected - got CURSER
I tried to debug for centuries, but are unable to the root of what could be the problem. I'd appreciate any help or idea people could offer
The only consolation I take from this is that Oracle have typo in one of their error messages :)
SQL MORE CODE
THE FUNCTION CODEselect * FROM TABLE(CAST(tsoraimpdb.QueryAuthorsFunc(116, 1, -1, 1, 0) as tsoraimpdb.ENTITYIDTABLE));
CREATE OR REPLACE FUNCTION &HKImpDB_Schema_Name..QueryAuthorsFunc ( aKGID NUMBER, aPageNumber NUMBER, -- The page interested aPageSize NUMBER, -- Number of records per page aOffset NUMBER, -- The offset = number of records already got aTotalRecord NUMBER -- Total number of users in the database ) RETURN sys_refcursor as l_FuncCur sys_refcursor; l_TotalRecord NUMBER(10) := aTotalRecord; l_Offset NUMBER(10) := aOffset; l_PagingTable TEMP_T_TABLE:= TEMP_T_TABLE(); -- paging set up l_MinRecordsOnAPge NUMBER(10); --last record on the previous page l_MaxRecordsOnAPge NUMBER(10); --last record on the current page begin DBMS_OUTPUT.PUT_LINE('start'); select KnowdePos(rownum,p.ID) bulk collect into l_PagingTable FROM KnowledgeGene kg INNER JOIN HKResource r ON kg.KGOwner = r.ID INNER JOIN Person p ON r.PersonID = p.ID WHERE kg.kgid = akgid ORDER BY p.FirstName + ' ' + p.LastName; l_TotalRecord := l_PagingTable.count; -- get total records DBMS_OUTPUT.PUT_LINE( l_TotalRecord); if aPageSize > 0 then if aPageNumber <= 0 then Raise_application_error(-20003,'Invalid Page Number'); else l_MinRecordsOnAPge := (aPageNumber-1)*aPageSize; l_MaxRecordsOnAPge := aPageNumber*aPageSize; end if; else -- if @PageSize < 0 return all records l_Offset := 0; l_MinRecordsOnAPge := 0; l_MaxRecordsOnAPge := l_TotalRecord; END if; -- return results for the correct page open l_FuncCur for SELECT pos from HKResource r INNER JOIN Person p ON r.PersonID = p.ID inner join TABLE(CAST(l_PagingTable AS TEMP_T_TABLE)) on pos = p.id WHERE KnowdeID > l_MinRecordsOnAPge - l_Offset AND KnowdeID <= l_MaxRecordsOnAPge - l_Offset; return l_FuncCur; EXCEPTION when NO_DATA_FOUND then null; end;
You cannot get the ref cursor in a table like this. Either use a PL/SQL program to extract the lines of ref cursor and display them via dbms_output.put_line (or something) or load the results into a collection and then cast the collection in a table in your select statement.
-
Expression-matter ORA-00932: inconsistent data types
I'm trying to use the following condition
Select
case
When
Count (exception.exception_number) > 1
then 0
on the other
ENTITY_TYPE_DEF.NAME
end name
With the exception of the table, exception_number has a varchar2 data type. My requirement is such that if the number of exception number is greater than 1, it should show 0 (integer) and if not then see the name column of the entity_type_def table (varchar2).
My query fails with the following error
ERROR on line 7:
ORA-00932: inconsistent data types: expected NUMBER obtained TANK
Please could someone suggest a workaround solution for above question.
Hello.
For example,.
Select
case
When
Count (exception.exception_number) > 1
then "0"
on the other
ENTITY_TYPE_DEF.NAME
end name
-
Why I get this error? ORA-00932: inconsistent data types
It's my stored procedure, I created to select only the exact amount of records per page to a GridView (for ASP.NET):
I then do a test case with the following parameters:CREATE OR REPLACE PROCEDURE SELECT_COMMAND (pTable IN VARCHAR2 , pFields IN VARCHAR2 , pSortField IN VARCHAR2 , pPageIndex IN NUMBER , pTotalRecs IN NUMBER , pResultSet OUT SYS_REFCURSOR ) AS BEGIN EXECUTE IMMEDIATE 'SELECT ' || pFields || ' FROM ' || '(SELECT '|| pFields ||', ROW_NUMBER() OVER(ORDER BY '|| pSortField ||') ROW_NUM ' || 'FROM '|| pTable ||') WHERE ROW_NUM BETWEEN '|| to_char(pPageIndex*pTotalRecs) ||' AND ' || to_char((pPageIndex+1)*pTotalRecs) INTO pResultSet; -- Plus 1 to our index because GridView is a zeroth index collection END SELECT_COMMAND;
But I get the following error:declare p_test sys_refcursor; begin select_command('v_sig_devices', '"JOB", "LINE"', '"DEVICE_ID"', 0, 10, p_test); end;
>
Error report: ORA-00932: inconsistent data types: expected - was -.
ORA-06512: at the 'SIM '. SELECT_COMMAND', line 10
ORA-06512: at line 4 level
00932 00000 - ' incompatible data types: wait %s %s got. "
>
At first Oracle gave me an error because the figures were not a string. Can I convert it to a string (with to_char) and Oracle is still not satisfied! Any ideas as to why this is happening?
Thanks for any help you can provide.Suppose you want sth. as
... OPEN pResultSet FOR 'SELECT ' || pFields || ' FROM ' || '(SELECT '|| pFields ||', ROW_NUMBER() OVER(ORDER BY '|| pSortField ||') ROW_NUM ' || 'FROM '|| pTable ||') WHERE ROW_NUM BETWEEN '|| to_char(pPageIndex*pTotalRecs) ||' AND ' || to_char((pPageIndex+1)*pTotalRecs) ; ...
-
Error ORA-00932: inconsistent data types
Hello world
I'm having a small problem with the error ORA-00932: inconsistent data types. The code below is what I'm working on. The error is on line 12:
"vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | '. vSchema |'. < table > @ < DB_LINK > '; ». This is because DDH_HOST_NM is a VARCHAR2 and DDH_SCHEMA_NR a number.
I know what is the error and where it is but I can't work on how to solve this problem. I tried to use to_char on DDH_SCHEMA_NR but that does not.
Anyone have an idea how I can fix this problem?
Thank you
N.S.N.O.
DECLARE
vSchema varchar2 (1000);
vStmt varchar2 (1000);
Version number (38);
CURSOR c_schemas IS
Select "< SCHEMA-NAME >" as "< scheme name >" twice;
BEGIN
Open c_schemas;
LOOP
SEEK c_schemas INTO vSchema;
EXIT WHEN c_schemas % NOTFOUND;
vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'. < table > @ < DB_LINK > ';
Run immediately vStmt in version;
dbms_output.put_line(vSchema||) e '|| Version);
END LOOP;
CLOSE C_schemas;
END;The problem is that you choose 2 columns in a single variable?
vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'.
@
';
Run immediately vStmt in version ;This must be either
vStmt: = ' select DDH_SCHEMA_NR from ' | vSchema |'.
@
';
Run immediately vStmt in version;or
vStmt: = ' select DDH_HOST_NM, DDH_SCHEMA_NR from ' | vSchema |'.
@
';
Run immediately vStmt in vHostNm, version;where vHostNm should set as a variable too.
-
ORA-00932: inconsistent data types: expected - got NUMBER
Hello
in 10g R2:
How to convert the rowid to be accepted in this query?SQL> select count(*) from sysman.MGMT_METRICS_RAW; select count(*) from sysman.MGMT_METRICS_RAW * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 3, block # 27080) ORA-01110: data file 3: 'D:\BASE\DB\DATA\SYSAUX01.DBF' SQL> select * from sysman.MGMT_METRICS_RAW where rowid=27080; select * from sysman.MGMT_METRICS_RAW where rowid=27080 * ERROR at line 1: ORA-00932: inconsistent datatypes: expected - got NUMBER
Thank youThis isn't the rowid. This is the block #.
-
ORA-00932: inconsistent data types: expected BLOB, CLOB had TANK
Hello
When exporting with the EXP utility, I have the following error:
My question is:. exporting private type synonyms . exporting object type definitions . exporting system procedural objects and actions . exporting pre-schema procedural objects and actions . exporting cluster definitions EXP-00056: ORACLE error 932 encountered ORA-00932: inconsistent datatypes: expected BLOB, CLOB got CHAR
what is the schema? Can there invalid objects by preventing him from EXP (see the Note 339938.1 on metalink).
Thank you.A way perhaps to query dba_feature_usage_statistics that shows in use and query dba_registry features which also shows the features installed.
HTH - Mark D Powell.
-
ORA-00932: inconsistent data types: expected - was -.
DECLARE STR VARCHAR2(2000):='<SerachVal>1234</SerachVal>'; L_OUT VARCHAR2(1000); BEGIN SELECT EXTRACTVALUE(STR,'/SerachVal') INTO L_OUT FROM DUAL; DBMS_OUTPUT.PUT_LINE(L_OUT); END; error: PL/SQL: ORA-00932: inconsistent datatypes: expected - got - PL/SQL: SQL Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error.
SQL> set serverout on SQL> DECLARE STR VARCHAR2(2000):='
1234 '; L_OUT VARCHAR2(1000); BEGIN SELECT EXTRACTVALUE(XMLTYPE(STR),'/SerachVal') INTO L_OUT FROM DUAL; DBMS_OUTPUT.PUT_LINE(L_OUT); END; 2 3 4 5 6 7 8 / 1234 PL/SQL procedure successfully completed. SQL> -
ORA-00932: inconsistent data types
Hello
on 10 GB R2 I have:
Question: How can I format sum (enddttm-begindttm) * 86400 hard?SQL> select x.* 2 --, d.descr 3 from ( 4 select prcstype, prcsname 5 , dur 6 , avg_dur 7 , freq 8 , rank() over (order by dur desc) prcrnk 9 from ( 10 select prcstype, prcsname 11 , count(*) freq 12 , sum(enddttm-begindttm)*86400 dur 13 , avg(enddttm-begindttm)*86400 avg_dur 14 from psprcsrqst p 15 where begindttm IS NOT NULL 16 and enddttm IS NOT NULL /*have completed*/ 17 and runstatus IN(9,11,14) /*sucessful processes*/ 18 and begindttm > SYSDATE - 30 /*in the last 30 days*/ 19 group by prcstype, prcsname 20 ) 21 ) x 22 , ps_prcsdefn d 23 where x.prcrnk <= 5 24 and d.prcstype(+) = x.prcstype 25 and d.prcsname(+) = x.prcsname 26 order by x.prcrnk; , sum(enddttm-begindttm)*86400 dur * ERROR at line 12: ORA-00932: inconsistent datatypes: expected NUMBER got INTERVAL DAY TO SECOND
Thank you.Hello
Sorry, but what are the data types of
enddttm
and
begindttm?with q as(select to_date('01-jan-2001') d1,to_date('31-dec-2000') d2 from dual) select dump(d1-d2),dump(to_dsinterval('+001 04:45:17')) from q DUMP(D1-D2) DUMP(TO_DSINTERVAL('+00104:45:17')) Typ=14 Len=8: 0,0,0,1,0,0,0,0 Typ=190 Len=24: 0,0,0,1,0,0,0,4,0,0,0,45,0,0,0,17,0,0,0,0,10,0,0,0
(a difference between 2 dates gives an interval of time, but wha'ts typ = 14?)
Published by: user11268895 on August 27, 2010 12:23
-
ORA-00932: inconsistent data types should had LONG
Hello
I would like to convert LONG LOB. I get the following error.
Does anyone have an idea?SQL> desc all_views Name Null? Typ ----------------------------------------- -------- ---------------------------- OWNER NOT NULL VARCHAR2(30) VIEW_NAME NOT NULL VARCHAR2(30) TEXT_LENGTH NUMBER TEXT LONG TYPE_TEXT_LENGTH NUMBER TYPE_TEXT VARCHAR2(4000) OID_TEXT_LENGTH NUMBER OID_TEXT VARCHAR2(4000) VIEW_TYPE_OWNER VARCHAR2(30) VIEW_TYPE VARCHAR2(30) SUPERVIEW_NAME VARCHAR2(30) SQL> SELECT to_lob(text) from all_views 2 where rownum <= 1; SELECT to_lob(text) from all_views * FEHLER in Zeile 1: ORA-00932: inconsistent datatypes expected got LONG
TO_LOB are usable in the SELECT an INSERT statement
SQL> create table t 2 (text clob) 3 / Table created. SQL> SQL> insert into t 2 SELECT to_lob(text) from all_views 3 where rownum <= 1; 1 row created. SQL> SQL> select * 2 from t 3 ; TEXT -------------------------------------------------------------------------------- select "FILE#","BLOCK#","CLASS#","STATUS","XNC","FORCED_READS","FORCED_WRITES"," {code} http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/functions139a.htm
-
SQL error: ORA-00932: inconsistent data types: expected - was -.
Hello
When I am tring to run under sql statement I ORA-00932.
Select extractvalue ("< rrr > 13 < /rrr > ',' / rrr'") twice;
How to extract this value?Select extractvalue (XMLTYPE ('
13 '),'/ rrr') twice; -
[8i] Case statement generates ORA-00932: inconsistent data types
Note: I work with a 8i database (Yes, he's old enough) and in this case, I have to deal with the types of data (e.g. TANK), I gives me to work with.
I am trying to calculate the amount of time product expected between manufacturing steps. As I found out though, sometimes I get a negative value then subtract the date the previous step ends the date of that ongoing stage begins. Since it is generally impossible to start a later stage before a previous step (imagine trying to screw a cap on a bottle that has no son Cup yet - it just may not happen), what I found is that sometimes two steps are started the same day and finished the same day (although not necessarily the day they started). This situation CAN occur when a person is two steps and connected to two steps at the same time, rather than log on to one, then the other. So what I need to do in these situations, is to replace the negative number by zero (I'll treat the stage as having no time-out).
Some examples of data:
(Note: the data set real is the result of a query and has about 200 K lines and columns more, but this should be representative enough to find a solution that works on my real application.)
Here's the query I use that sometimes returns negative values:CREATE TABLE steps ( item_id CHAR(25) , ord_nbr CHAR(10) , sub_nbr CHAR(3) , step_nbr CHAR(4) , start_date DATE , finish_date DATE ); INSERT INTO steps VALUES ('A','0000000001','001','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','001','0020',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','001','0030',TO_DATE('01/05/2011','mm/dd/yyyy'),TO_DATE('01/06/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0020',TO_DATE('01/04/2011','mm/dd/yyyy'),TO_DATE('01/04/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0030',TO_DATE('01/06/2011','mm/dd/yyyy'),TO_DATE('01/07/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('B','0000000002','001','0005',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('B','0000000002','001','0025',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
These are the results I want to see:SELECT item_id , ord_nbr , sub_nbr , step_nbr , start_date - last_step_finished FROM ( SELECT s.* , LAG (s.finish_date) OVER ( PARTITION BY s.item_id , s.ord_nbr , s.sub_nbr ORDER BY s.step_nbr ) AS last_step_finished FROM steps s ); Returns: ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED ------------------------- ---------- --- ---- ----------------------------- A 0000000001 001 0010 A 0000000001 001 0020 -1.000 A 0000000001 001 0030 3.000 A 0000000001 002 0010 A 0000000001 002 0020 2.000 A 0000000001 002 0030 2.000 B 0000000002 001 0005 B 0000000002 001 0025 -2.000
And that's what I tried to do to get these results (comment pointed out which line has generated the error):ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED ------------------------- ---------- --- ---- ----------------------------- A 0000000001 001 0010 A 0000000001 001 0020 0.000 A 0000000001 001 0030 3.000 A 0000000001 002 0010 A 0000000001 002 0020 2.000 A 0000000001 002 0030 2.000 B 0000000002 001 0005 B 0000000002 001 0025 0.000
I know that I had errors in data type incompatible before with case statements in this particular 8i database, but I can't seem to understand why I'm getting one this time. I think it has something to do with the NULL value which may occur for last_step_finished. Also, if I change the case statement to:SELECT item_id , ord_nbr , sub_nbr , step_nbr , CASE WHEN start_dt - last_step_finished < 0 THEN 0 ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR END AS days_in_queue FROM ( SELECT s.* , LAG (s.finish_date) OVER ( PARTITION BY s.item_id , s.ord_nbr , s.sub_nbr ORDER BY s.step_nbr ) AS last_step_finished FROM steps s );
the query works fine. But, I'm not NULL, I 0. In the level of this request, I'll take the averages by item_id/step_nbr, and I want that 0 s to be included in the average. (NULL values, as far as I know, would be excluded. AVG(null,_1,_2) = AVG (1,2) = 1.5 NOT AVG (0,1,2) = 1)., CASE WHEN start_dt - last_step_finished < 0 THEN NULL ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR END
Thanks in advance!CASE requires that all expressions to be of the same type. Numeric data type code is 2, then that date produced different internal datatype 14:
SQL> select dump(1) a,dump(sysdate) b,dump(sysdate - (sysdate - 1)) c from dual; A B C ------------------ ----------------------------------- ------------------------------ Typ=2 Len=2: 193,2 Typ=13 Len=8: 219,7,6,27,13,7,50,0 Typ=14 Len=8: 1,0,0,0,0,0,0,0 SQL>
Case is supposed to process until the number, but it does not--a bug in some versions. Use explicit to_number:
, CASE WHEN start_dt - last_step_finished < 0 THEN 0 ELSE to_number(start_dt - last_step_finished) END AS days_in_queue
SY.
-
ORA-00932: inconsistent data types: expected NUMBER obtained CURSER
Hello
I created a function that returns the cursor
try to use the same report in
Apex 4.2.3
Select double hapx_details(:p5_brnach,:p5_remark)
Help, please
function is;
create or replace function hapx_details ( brcode in d009022.lbrcode%type, lheading in varchar2) return sys_refcursor is x_cursor sys_refcursor; vquery varchar2(1000); begin if upper(trim(lheading))='TERMDEPOSITS' THEN vquery:='select lbrcode,t_cust(lbrcode,prdacctid) custno,short_acno(prdacctid) acno,ACNAME(LBRCODE,PRDACCTID) NAME,t_ost_new(lbrcode,prdacctid,SYSDATE) bal from dep_mast where lbrcode=brcode'; elsif upper(trim(lheading))='ADVANCES' THEN VQUERY:='SELECT LBRCODE,CUSTNO,SHORT_ACNO(LBRCODE,PRDACCTID)ACNO,NAMETITLE,LONGNAME NAME ,t_ost_new(lbrcode,prdacctid,SYSDATE) bal FROM ac_mast WHERE LBRCODE=BRCODE AND (LBRCODE,TRIM(SUBSTR(PRDACCTID,1,8))) IN (SELECT LBRCODE,TRIM(PRDCD) FROM D009021 WHERE MODULETYPE IN (13,14,30)) AND ACCTSTAT<>3'; ELSE VQUERY:='SELECT LBRCODE,CUSTNO,SHORT_ACNO(LBRCODE,PRDACCTID)ACNO,NAMETITLE,LONGNAME NAME,t_ost_new(lbrcode,prdacctid,SYSDATE) bal FROM ac_mast WHERE LBRCODE=BRCODE AND (LBRCODE,TRIM(SUBSTR(PRDACCTID,1,8))) IN (SELECT LBRCODE,TRIM(PRDCD) FROM D009021 WHERE MODULETYPE IN (11,12)) AND ACCTSTAT<>3'; END IF; -- OPEN X_CURSOR FOR VQUERY; RETURN X_CURSOR; END HAPX_DETAILS;
The proper way is to define a function that returns the SQL statement (with bind variable) Apex need to run to the region to report.
Say you have a region that reports of departments (Department variable is zero) or employed in a service (Department non-null variable).
You have a page element called P1_DEPT that specifies the Department.
You create the function call following the report:
() MyDynamicReport
depatvalue =>: P1_DEPT,-value of variable in apex
deptvariable-online "P1_DEPT" - the apex variable name
);
The function can now determine what is SQL and who will return to the Apex engine for processing:
create or replace function MyDynamicReport (deptValue number, deptVar varchar2) return varchar2 is
sqlQuery varchar2 (1000);
Start
If deptValue is null then
-no service selected, so ask all the departments
sqlQuery: = ' select * from dept by dept_id';
on the other
-service selected, so display employees in the Department
-(and use the link provided in the SQL query variable)
sqlQuery: = ' select * from emp where dept_id = :'|| deptVar | "order by emp_id;
end if;
return (sqlQuery);
end;
When you create a ref cursor, you pass the VALUE of the variable for the ref cursor to be used as a variable binding.
With a dynamic query Apex, you must pass the NAME of the variable for the function to use and add in the text of the dynamic query.
To using a function table of pipeline to do this, is rather silly.
Maybe you are looking for
-
Why an installation of XP on a Tecra S1 takes so long?
Hi allJust bought a computer laptop tecra S1 hand 2nd off ebay. The hard drive didn't work more to have bought another and I'm trying to do a clean install of windows xp. I've done it before on many desktop computers, but never on a laptop. The insta
-
I have a T440 which gives a fan error message and then stops immediately. And of course it just went out of warranty last month! Ideas like how to fix?
-
I'm reading a file that is in binary, and I've been uncessful, I get the following error message: error 7 has occurred to open/create/replace file in TESTEXAMPLE.viand the possible reason is: LabVIEW: file not found. The file may be in a location dif
-
I have lost volume on my comp. and cannot find how to get it back
I lost the volume on my comp. and may not know where to. The icon went!
-
Installation of windows on a drive external hard and then transfer them on laptop?
Hi all Just trying to install Win7 on my friends laptop. Seen the questions and had an idea. If I remove the hard drive, use it as a hard drive via a caddy, completely format and delete partitions, install win7 top via USB on my laptop, if I then put