NVL function issue
Hello All,
I have a strange problem with a NVL function. In one of the view I am using a NVL fuction like this "NVL(doc_id,'-1') doc_id' and when I am
querying the view based on the doc_id it is taking more time because of the this NVL function.I removed the same and tested it is coming out withing milli secs.
Is there any way or any other function I can use.one more thing DOC_ID in the table is a VARCHAR2 field.
Please help me with this.
Best regards,
Pavan Patil
Tried Case not working ......
Please find the query (Table names and joines mentioned are not proper ones) ---
SELECT DECODE (tdoc.case_ver_no,
-1, -1,
c.uwrt_case_tid
) case_tid,
c.case_id case_id, c.case_ver_no case_version_no,
c.prft_cntr_sid profit_cntr,
c.jnt_life_qualf_cd joint_life, c.co_id co_id,
(SELECT co_lnm
FROM t
WHERE cd = c.cd) co_lnm,
ald.given_nm first_name, ald.mid_nm middle_name,
ald.family_nm last_name, ald.life_idx_id life_id,
ald.sex_cd gender, al.doc_handle_id doc_handle_id,
alb.bnft_cd benefit_type,
alb.propsl_si_amt propsl_fc_amt, c.crncy_cd crncy_cd,
c.indiv_grp_cd individual_group_code,
c.assmnt_typ_cd assessment_type,
c.cli_ref_id client_ref,
DECODE (TO_CHAR (tdoc.case_ver_no),
'-1', '-1',
c.uwrt_id
) underwriter_id,
c.bu_cd bu_cd, al.assmnt_age_offset age,
(SELECT alb.bnft_cd rider_type
FROM te al,
tt alb,
tuwrt_case c
WHERE alb.main_bnft_ind <> 1
AND al.atid = alb.atid
AND al.utid = c.utid
AND c.case_id = c.case_id
AND ROWNUM = 1) rider_type,
(SELECT stat_cd
FROM tat
WHERE uwrt_case_tid = c.uwrt_case_tid
AND seq_no =
(SELECT MAX (ucs1.seq_no)
FROM tat ucs1
WHERE ucs1.uwrt_case_tid = c.uwrt_case_tid))
status,
NVL(tdoc.doc_id,'-1') doc_id, tdoc.doc_ttl doc_ttl,
tdoc.doc_typ_cd doc_typ_cd,
tdoc.bof_doc_catg_cd bof_doc_catg,
tdoc.doc_prim_catg_cd doc_prim_catg,
tdoc.doc_lang_cd doc_lang_cd, tdoc.doc_nm doc_nm,
tdoc.doc_crte_meth_cd doc_crte_meth_cd,
tdoc.doc_del_stat_cd doc_del_stat_cd,
tdoc.doc_fmt doc_fmt,
tdoc.doc_lock_user_id doc_lock_user_id,
tdoc.doc_lock_ts doc_lock_ts, tdoc.doc_ver doc_ver,
tdoc.doc_size doc_size,
tdoc.doc_ind_stat_cd doc_ind_stat_cd,
tdoc.doc_ind_user_id doc_ind_user_id,
DECODE (tdoc.doc_ind_loc_cd,
'CA', 'CAN',
'CARB', 'CAN',
tdoc.doc_ind_loc_cd
) doc_ind_loc_cd,
tdoc.last_upd_user_id last_upd_user_id, tdoc.upd_ts,
TO_DATE
(TO_CHAR (TO_DATE (tdoc.doc_recv_dt,
'yyyymmddhh24miss'
'MM/DD/YYYY HH24:MI:SS'
'MM/DD/YYYY HH24:MI:SS'
) doc_recv_dt,
TO_DATE
(TO_CHAR (TO_DATE (tdoc.doc_attch_dt,
'yyyymmddhh24miss'
'MM/DD/YYYY HH24:MI:SS'
'MM/DD/YYYY HH24:MI:SS'
) doc_attch_dt
FROM tt c,
ttl,
ttd,
ttft alb,
ttoc tdoc
WHERE al.u_tid(+) = c.u_tid
AND ald.a_tid(+) = al.a_tid
AND alb.astid(+) = al.astid
AND tdoc.doc_handle_id(+) = al.doc_handle_id
AND alb.main_ind(+) = 1
AND NVL (tdoc.doc_del_stat_cd, 'XX') != 'DELETD'
Similar Messages
-
Performance Hit Due to NVL() Function
Hi,
I am from dev project team,we are facing a performance hit due to NVL() function,pls give a solution to resolve this issue.
the below is my function which i created to calculate some efforts.
create or replace function check_function(
v_deal_detail ,
v_tower ,
v_subtower,
v_location ,
v_client_role ,
v_emp_category ,
v_year ,
v_state )
return number
is
v_trans_offshore_efforts number(30,8) default 0;
v_stdy_offshore_efforts number(30,8) default 0;
begin
if v_state =1
or v_state is null
then
begin
select nvl(sum(decode (d.loc_type_id,
crmuat_global_constant_pkg.GLB_OFFSHORE,
s.trans_efforts,
0)),0)
into v_trans_offshore_efforts
from prc_calc_trans_fte_dtls_t s, prc_deal_dtl_loc_dtls_t d
where s.deal_detail_id= d.deal_detail_id
and s.tower_id = d.tower_id
and s.location_id = d.location_id
and s.deal_detail_id = v_deal_detail
and s.client_role_id = nvl(v_client_role,s.client_role_id)
and s.emp_category_id = nvl(v_emp_category,s.emp_category_id)
and s.tower_id = v_tower
and s.subtower_id = nvl(v_subtower,s.subtower_id)
and s.location_id = nvl(v_location,s.location_id)
and s.year_no = v_year;
exception
when no_data_found
then
v_trans_offshore_efforts := 0;
end;
end if;
if v_state = 1
then
return v_trans_offshore_efforts;
end if;
end;
pls give me a solution.
Regards,
shinu{message:id=9360003}
-
Function issue of Cross-Reference
Hi,
thanks for your attention on this topic.
there is function issue of Cross-Reference.
when click the Cross-Reference after re-installed the software (adobe Framemaker 7.10), the function is not working. please kindly check the screenshots below:
Error message below:
Please help to check this issue.
software: Adobe Framemaker 7.10
System: windows xp sp3
thanks in advance for your support .
Message was edited by: Lu StevenFire the error log off to the e-mail address indicated in the error message and then contact Adobe Support.
-
Using insert command in NVL function
How can we use insert command in a NVL function
exapmle : INSERT INTO employee
VALUES ( (NVL ( (SELECT emp_id
FROM employee
WHERE emp_name LIKE 'Test'),
(insert into employee values((select max(emp_id)+1 from employee),'Test')))));
I mean i will check for the record to exist in the table and if not exist i will add it to the table.998504 wrote:
How can we use insert command in a NVL function
exapmle : INSERT INTO employee
VALUES ( (NVL ( (SELECT emp_id
FROM employee
WHERE emp_name LIKE 'Test'),
(insert into employee values((select max(emp_id)+1 from employee),'Test')))));
I mean i will check for the record to exist in the table and if not exist i will add it to the table.The first thing caught my eye is this
max(emp_id) +1A real bad piece of code. Never do that. Ever thought about multi user environment? Use a SEQUENCE.
If you want EMP_NAME to be unique (Which looks strange to me), then just add a UNIQUE constraint. You dont try to do what oracle already does really well. -
hi,
i want to use nvl Function in that Quary
select f_words(SUM(a.AMOUNT)+sum(a.vat_amount) +
nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
from LAB_WORK_DTL b
where a.bill_no =b.bill_no), 0)
)) as t
from TRANSACTION_DETAILS a
where a.bill_no =:P42_bill_no
group by a.BILL_NO;
i am using NVL in that Quary Like This
select f_words*(nvl(S*UM(a.AMOUNT)+sum(a.vat_amount) +
nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
from LAB_WORK_DTL b
where a.bill_no =b.bill_no), 0)
)) as t
from TRANSACTION_DETAILS a
where a.bill_no =:P42_bill_no
group by a.BILL_NO;
I want to use NVL Function In BOLD
How Can I use NVL Functiion.
Thanks
Edited by: Manoj Kaushik on Mar 25, 2010 5:55 AMhi,
select f_wordsl(SUM(a.AMOUNT)+sum(a.vat_amount) +
nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
from LAB_WORK_DTL b
where a.bill_no =b.bill_no), 0)
)) as t
from TRANSACTION_DETAILS a
where a.bill_no =:P42_bill_no
group by a.BILL_NO;
i have two tables Bill no is comman field in both tables if i have not enter value in any one of the table .
so how can i show Total amount in words if Bill NO are not in any one table.
Thanks -
Compilation problems using NVL function in Pro*C subselect
I have come across a weird oracle problem. When I execute the following query in SQLPlus it works but when
I include it in Pro*C code in a EXEC SQL statement it gives syntax errors and fails to compile. Any idea what I am doing wrong.
SELECT DISTINCT
A.ID_PERSON,
C.ID_STAGE_PERSON_LINK ,
A.NM_PERSON_FULL,
A.NBR_PERSON_AGE,
A.ADDR_PERSON_ST_LN_1,
A.ADDR_PERSON_CITY,
A.ADDR_PERSON_ZIP,
A.CD_PERSON_STATE,
A.CD_PERSON_COUNTY,
A.NBR_PERSON_PHONE,
C.CD_STAGE_PERS_REL_INT
FROM
PERSON A,
STAGE_PERSON_LINK C
WHERE
C.ID_CASE = 88776721
AND A.IND_INVALID_PERS IS NULL
AND C.CD_STAGE_PERS_TYPE = 'PRN'
AND C.ID_PERSON = A.ID_PERSON
AND C.ID_STAGE_PERSON_LINK =
NVL (
(SELECT MAX(F.ID_STAGE_PERSON_LINK)
FROM STAGE_PERSON_LINK F
WHERE F.ID_PERSON=C.ID_PERSON
AND F.ID_CASE = C.ID_CASE
AND F.CD_STAGE_PERS_TYPE = 'PRN'
AND F.CD_STAGE_PERS_REL_INT IS NOT NULL)
(SELECT MAX(G.ID_STAGE_PERSON_LINK)
FROM STAGE_PERSON_LINK G
WHERE G.ID_PERSON=C.ID_PERSON
AND G.ID_CASE = C.ID_CASE
AND G.CD_STAGE_PERS_TYPE = 'PRN')
AND A.ID_PERSON NOT IN
SELECT S.ID_PERSON
FROM STAGE_PERSON_LINK S,STAGE T
WHERE S.ID_CASE = C.ID_CASE
AND S.ID_CASE = T.ID_CASE
AND S.ID_STAGE = T.ID_STAGE
AND T.CD_STAGE <> 'INT'
MINUS
SELECT H.ID_PERSON
FROM STAGE_PERSON_LINK H, STAGE F
WHERE H.ID_CASE = F.ID_CASE
AND H.ID_STAGE = F.ID_STAGE
AND H.ID_CASE = C.ID_CASE
AND H.CD_STAGE_PERS_ROLE <> 'XE'
AND F.CD_STAGE <> 'INT'
This query returns data when run in sqlplus.When used in a Pro*C C program and compiled the precompiler complains with syntax errors when used with EXEC SQL DECLARE CLSS82D_CURSOR CURSOR FOR < query above >.However removing the NVL function and retaining the subselect clause compiles but that is not what I want to do.
Syntax error at line 262, column 20, file clss82d.pc:
Error at line 262, column 20 in file clss82d.pc
SELECT MAX( F.ID_STAGE_PERSON_LINK )
...................1
PCC-S-02201, Encountered the symbol "MAX" when expecting one of the following:
( ) * + - / . @ | at, day, hour, minute, month, second, year,
The symbol "(" was substituted for "MAX" to continue.
Syntax error at line 263, column 10, file clss82d.pc:
Error at line 263, column 10 in file clss82d.pc
FROM STAGE_PERSON_LINK F
.........1
PCC-S-02201, Encountered the symbol "FROM" when expecting one of the following:
, ) * + - / | at, day, hour, minute, month, second, year,Pro*C works bit differently tha sqlplus. try removing the blank line after
SELECT MAX(G.ID_STAGE_PERSON_LINK)
FROM STAGE_PERSON_LINK G
WHERE G.ID_PERSON=C.ID_PERSON
AND G.ID_CASE = C.ID_CASE
AND G.CD_STAGE_PERS_TYPE = 'PRN')
good luck,
Gauranga -
NVL function's strange behaviour
Hi,
I have a sql statement (listed below) that uses NVL function which returns either the business name of branch name depending on whether the business name is null or not. It also uses the branch_name pl/sql function that returns the name of the branch.
What I found strange was that it executes the branch_name function even when the business_name is not null. It was my understanding that nvl returns expr1 if it's not null, and expr2 if expr1 is null. I don't want it to execute the branch_name function if business_name exists. Is it possible using NVL, or do I need to use DECODE to achieve that? p_record_id is a parameter that I pass to the function containing the sql statement e.g., p_record_id=10.
SELECT nvl( business_name, branch_name( p_record_id) ) "Name"
FROM entity
WHERE record_id = p_record_id;
Thanks
VicMarc,
Thanks for looking into it.
I just ran the code using DECODE and it seems that it executes the function only when the condition is true, which is exactly what I want. It won't execute the function if the condition is false, e.g., in the code below if the business_name is null then it executes the branch_name function, other wise it returns the business_name.
SELECT DECODE ( business_name,
null, branch_name( p_record_id ),
business_name ) "Name"
FROM entity
WHERE record_id = p_record_id;
Vic -
NVL Function on CLOB data type
Hi all,
I am not able to use the NVL function over clob..please suggest me a way to do the data validation of the CLOB in sql ....
below is the query i was using...
select t1.pic_name,t2.pic_name
from table1 t1,table2 t2
where nvl(t1.picture_message,'X') <> nvl(t2.picture_message,'X');i am getting the following error....
ORA-00932: inconsistent datatypes: expected - got CLOBThanks
RedeYour problem is not NVL but rather comparing CLOBs:
SQL> desc tbl1
Name Null? Type
ID NUMBER
X CLOB
SQL> desc tbl2
Name Null? Type
ID NUMBER
X CLOB
SQL> select nvl(x,'NULL CLOB')
2 from tbl1
3 /
NVL(X,'NULLCLOB')
NULL CLOB
SQL> select *
2 from tbl1,
3 tbl2
4 where tbl1.x = tbl2.x
5 /
where tbl1.x = tbl2.x
ERROR at line 4:
ORA-00932: inconsistent datatypes: expected - got CLOB
SQL> SY. -
NVL Function and Truncate Function in Template Builder
Hi Guys,
How would I use NVL function and Truncate function in the Word Template Builder.
These functions do not work in the Query Builder when i use SQL Query as the Dataset while creating a report.
I could not find examples in the Publisher Guide either.
Thanks
rkingmduHi
How can you not use the functions in your query? Does the builder return an error? ow about just pasting your query into the report definition does the nvl/trunc work then ?
Regards
Tim
http://blogs.oracle.com/xmlpublisher -
I ran across a problem with the format of an ASCI output file of an SQL script. The problem I have is with handling a particular column that contains account numbers. The column is defined with 8 characters. However not every entry has data. I have several fields that don't have any information.
Originally in my script I had the following line that made the script fail:
LPAD(TO_CHAR(TO_NUMBER(konten_nr)),8,'0'),
I then changed the line to the following: (The script ran but now I notice that the formatting is wrong)
LPAD(TO_NUMBER(LTRIM(konten_nr)),8,'0'),
I attempted to use the NVL function that will return a value when there is nothing in the column field but it doesn't work. Does anyone know what I'm doing wrong?
LPAD(NVL(TO_CHAR(TO_NUMBER(konten_nr),'FM999999999'),'0'),8,'0'),what is exactly your problem ?
you want to translater " 1234" in "00001234" ? then simply use to_char(konten_nr,'FM00000000') .
You want to translate " 1 1 1 1" in "01010101", then use replace(konten_nr,' ','0')
Give us some samples -
Binding problem when using NVL function
Hello.
I have a problem with my ADF application (11.1.2.1).
I use VO with a query (database view) - pivot table.
If i use where clause like table.attr = :p_attr, everything works ok.
If i use where clause like table.attr = NVL (:p_attr, table.attr) and put a value in :p_attr (executeWithParam) , query executes as if there is a null value.
Debug console shows:
Binding null of type 12 for "p_attr".
Query with NVL works ok in sqldeveloper.
But in jdev, as if the table attribute isn't bind to bind variable.
If a just remove NVL function, it works.
Any idea?
Thanks.
Regards
Edited by: DejanH on Oct 6, 2011 1:32 PMHello.
I enter 50 in p_depart parameter and click "ExecuteWithParams". Query is executed and shows records (pivot table).
But if i look at the log window i see that an empty query was executed first.
<OracleSQLBuilderImpl> <bindParamValue> [427] Binding null of type 12 for "p_depart"
<OracleSQLBuilderImpl> <bindParamValue> [428] Binding null of type 12 for "p_job"
<OracleSQLBuilderImpl> <bindParamValue> [429] Binding null of type 12 for "p_hire_od"
<OracleSQLBuilderImpl> <bindParamValue> [430] Binding null of type 12 for "p_hire_do"
Then, it is autoexecuted for the second time with parameter set to the value i inserted.
<OracleSQLBuilderImpl> <bindParamValue> [470] Binding param "p_depart": 50
<OracleSQLBuilderImpl> <bindParamValue> [471] Binding null of type 12 for "p_job"
<OracleSQLBuilderImpl> <bindParamValue> [472] Binding null of type 12 for "p_hire_od"
<OracleSQLBuilderImpl> <bindParamValue> [473] Binding null of type 12 for "p_hire_do"
The same happens in our query. But ours is much more complex and it takes a lot of time to first execute "empty" query and then with inserted parameter.
We cannot use it.
It looks like bug.
Regards
Edited by: DejanH on Oct 11, 2011 6:52 AM -
Depending on how this discussion board works, I will attempt to update functional issues with this operating system.
9/21/13: Alarm: Setting the alarm is rather akward, the numbers are too rigid, fine, and small. I feel the numbers being larger would be more user friendly.
9/21/13 Calendar: Previous version was superior in certain ways. Shading out a part of the day which you typically don't use (ex: 1am-5:30am) would be great. I feel lost in this update, it does not feel refined. Please allow me to send an appointment through imessage already as well!Tell Apple.
http://www.apple.com/feedback/iphone.html -
Hi All!
Is there any forum related to functional issues in SD and MM.Please do forward me the names if there are any.
Regards
PavanCheck these
http://www.sapfans.com/
http://www.erpfans.com/
http://www.sap.com/community/default.epx?logonStatusCheck=0 (Login required)
Regards,
Vikas Madaan -
SGD 4.5 Desktop Functionality Issue
I've come across an odd functionality issue on SGD 4.5. When I start "My Desktop" everything works fine. However if I start a new Full JDS Desktop session on another server, the JDS session doesn't appear to load correctly. New windows automatically open in the upper left corner and can't be moved. If I close both JDS Desktop sessions and open the other system first, then "My Desktop" session doesn't open windows properly. Has anyone come across this? It's not to big of deal right now, but it might become more of an issue when more users start using our SGD instance.
Adam@JRoesler :
The script for installing the users during installation when the users are not created is included some version before the 4.50.907
The SGD version here is only 1 minor version before the latest release.
@aspenhedge:
If I look into the rpm (for Linux install) I don't see a check for a valid shell. It does however try to 'su' into those accounts. I might be wrong in this one.
Can you manually use 'su ttaserv' and 'su ttasys' without any problem? Do these users have a valid home-dir for example.
- Remold -
Similar to NVL function for SPACE
Is there any function which will detect SPACE
and update in that place to NULL.
like NVL(TEST_INPUT,NULL)Is there any function which will detect SPACE
and update in that place to NULL.Check it out...
SQL> select replace('A P C', ' ', null) from dual
2 /
REP
APC
SQL> Cheers, APC
Blog : http://radiofreetooting.blogspot.com/
Maybe you are looking for
-
Capturing Stock in transfer qty and open PR qty
hi I am developing a report where I want to capture the following data: 1) Stock in transfer CC quantity (Inter company transfer) 2) Open PR quantity Can you plz suggest from where(Table name) I can capture this data? Answer will be awared with full
-
ICal quits immediately upon launch
My iCal crashes ("quits unexpectedly") shortly after it launches. An example problem report is appended below. If I switch to another user, iCal works fine. I can even take the *.ics files from my main (crashing) user arrount and open them in iCal un
-
How do i set up a wireless itunes network in multiple rooms???
I'm trying to add multiple Airport express units(in different rooms), to my wireless network (internet only). I have two express units and apple TV and want to be able to play music via itunes through 1 or more, or all of the rooms! I'm buggered if I
-
Transfer itunes download from another device
i downloaded a handful of songs on my ipad. Now I want those songs on my mac computer. it says they have been downloaded from i cloud but I can't find them in my itunes music folder on my mac. What am I doing wrong?
-
How to re-install internet drivers
I got up yesterday morning to do some work and my notebook would not connect to the internet. I tried all the tricks in the book and finally had to call the internet help desk. Somehow, my drivers for internet connectivity have been deleted. I can