Update Upper row column value in null column in sql 2008
Hi All,
I want to update Upper row value into lower null value column dynamically . i have 10000 record .
any one have sql query or any idea.Please help
Akhilesh Sahu Sr.Software Developer
Hi akhilesh,
Based on your description, you want to Sorting by a specified order that NULL value should be located in the bottom of some columns. If in this scenario, we can try to add a calculated field to convert the values of the field to A, B depend on the specified
order. Then Sorting the field by A to Z to achieve your requirement. For more details, please refer to the following steps:
Right-click the dataset to add a calculated field named Order with the expression like below:
=iiF(Fields!CircleId.Value="","B","A")
Right-click the report item to open the properties dialog box.
Click Sorting in the left pane, then add a sorting as below:
Sort by: [Order]
Order: A to Z
If you have any other questions, please feel free to let me know.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Similar Messages
-
ORA-01405: fetched column value is NULL
Hi All,
I am using OWB 10gR2 and DB 10gR2. I am getting the following error while executing the mapping,
ORA-01405: fetched column value is NULL.
I have used NVL function for the measure columns, but the problem is not solved.
Can anybody please tell me solution,
Thanks in advance,
SivaHi Siva
It may be that you've taken care of null value in just one place and now, the error is coming
from somewhere further down the line.
Regards
Arif -
Need Help :: Current row attribute value returning null
Hi Frds,
I am facing the problem that
Current row attribute value returning null............ even though value is there..... plz.. he
This is the code in PFR
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
String pPersonId = pageContext.getParameter("ctrlPersonId");
String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
OptionsVORowImpl curRow = ( OptionsVORowImpl) am.findRowByRef(rowReference);
String dtlsItem = (String)curRow.getFlexValue(); /* this is returning null value */
/* here creating the hashmap and calling the page with the hashmap*/
Thanks & Regards,
jaya
Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810Hi Jaya,
You want to catch Flexfield values?
Try below code for catch value.
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
String dtlsItem = (String)Stylebean.getText(pageContext);
/* here creating the hashmap and calling the page with the hashmap*/
Thanks,
Dilip -
Sorry guys, is there anyone who can explain me the null behaviour on SQL 2008? I mean, I got this select
select customername, contract, CONVERT(varchar(6),settlementdate,112) as per, sum(consumption) as
weight, SUM(gp2) as gp, SUM(tot) as abp, SUM(ccost) as ccost,
from big15 group by customername, contract, CONVERT(varchar(6),settlementdate,112)
That retrieves me
Warning: Null value is eliminated by an aggregate or other SET operation.
(22118 row(s) affected)
Now I'm wondering, what means? That it has considered the null as zero value? Or that it has truncate or dropped the rows cointaning a null value? It's something I lost in my brain.
And in this case:
select customername, contractid, CONVERT(varchar(6),settlementdate,112) as per, gp, abp, ccost, RcCost,
(gp + abp + ccost + rccost) as tot
That return null if there is a null value. Now
I am going to try Isnull or Coalesce but what concern me is the first question. In a sum column what is the rule on SQL. Zero or drop ( don't consider) the row?>>>Warning: Null value is eliminated by an aggregate or other SET operation.
You have SUM aggregation function which returns NULL for some data....(you may have COALESCE function to handle the NULLs)
>>>(gp + abp + ccost + rccost) as tot
Again use (coalesce(gp,0)
+ coalesce(abp,0) + coalesce(ccost,0) + coalesce(rccost,0)) as tot
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to avoid to check if a column value is NULL?
Hi, I'm a newbee in Oracle.
I have a procedure like this:
create or replace
PROCEDURE get_employee
v_first_name IN VARCHAR2 DEFAULT NULL ,
v_middle_name IN VARCHAR2 DEFAULT NULL ,
v_last_name IN VARCHAR2 DEFAULT NULL ,
To select rows with matching multiple column values, I can simply do this:
SELECT *
FROM employee
WHERE first_name = v_first_name
AND middle_name = v_middle_name
AND last_name = v_last_name
The problem is v_middle_name can be NULL. This means,
I need check if v_middle_name is NULL, and if it is, I need use "IS NULL" instead, like this:
SELECT *
FROM employee
WHERE first_name = v_first_name
AND middle_name IS NULL
AND last_name = v_last_name
It seems very cumbersome to do a check for each column that can be null.
Is there a way that I do not need to do a check for every column?
or is it better to avoid having NULL values in those columns (and replace them with, say a space) ?
Thanks in advance.
SimonNormally, you would do something like
SELECT *
FROM employee
WHERE first_name = NVL( v_first_name, first_name )
AND middle_name = NVL(v_middle_name, middle_name )
AND last_name = NVL(v_last_name, last_name )Of course, if you can ensure that NULL data is not allowed (without creating phony non-NULL data), that is a good thing. In most systems, for example, it is probably reasonable to require a non-NULL first and last name. But you almost certainly cannot require a middle name.
Justin -
Id column values for null objects
If I have something like the following, where B.id is mapped to an INTEGER
column in A's table, Kodo wants to store a NULL value into the column. This
doesn't work if the column is specified as NOT NULL. Is there a way to
configure Kodo to use some predefined integer value instead, such as 0
or -1?
class A {
int id;
B b;
class B {
int id;
A a = new A();
a.id = 123;
a.b = null;
pm.makePersistent(a);
pm.currentTransaction().commit();I'm not sure what you mean by "value mapping." In my case, I am mapping a
null reference to another object. I am using application identity. Here's a
more complete example (still very abbreviated, but hopefully complete
enough):
class A {
static class Id { int id; }
int id;
B b;
class B {
static class Id { int id; }
int id;
int value;
create table A (ID integer not null, BID integer not null)
create table B (ID integer not null, VALUE integer)
<jdo>
<package name="test">
<class name="A" objectid-class="A$Id">
<extension vendor-name="kodo" key="table" value="A"/>
<field name="id" primary-key="true">
<extension vendor-name="kodo" key="data-column" value="ID"/>
</field>
<field name="b">
<extension vendor-name="kodo" key="id-data-column" value="BID"/>
</field>
</class>
<class name="B" objectid-class="B$Id">
<extension vendor-name="kodo" key="table" value="B"/>
<field name="id" primary-key="true">
<extension vendor-name="kodo" key="data-column" value="ID"/>
</field>
<field name="value">
<extension vendor-name="kodo" key="data-column" value="VALUE"/>
</field>
</class>
</package>
</jdo>
A a1 = new A();
a1.id = 123;
a1.b = new B();
a1.b.id = 456;
a1.b.value = 999;
pm.makePersistent(a1);
A a2 = new A();
a2.id = 789;
a1.b = null;
pm.makePersistent(a2);
pm.currentTransaction().commit();
The inserts for table A look something like this:
insert into A (ID, BID) values (123, 456)
insert into B (ID, VALUE) values (456, 999)
insert into A (ID, BID) values (789, NULL)
The NULL value fails because the column is specified as NOT NULL
(pre-existing schema scenario).
What I need to be able to do is specify what value gets inserted for null
object references. Kodo is inserting NULL. I need to insert -1. -
How to Update the oracle toad column value in table by using SSRS 2008
Hi Team,
How to update the oracle DB table column value by using SSRS 2008.
Can any one help me on this.
Thanks,
Manasa.
Thank You, Manasa.VHi veerapaneni,
According to your description, you want to use SSRS to update data in database table. Right?
Though Reporting Services is mostly used for rendering data, your requirement is still can be achieved technically. You need to create a really complicated stored procedure. Pass insert/delete/update and the columns we need to insert/delete/update as
parameters into the stored procedure. When we click "View Report", the stored procedure will execute so that we can execute insert/delete/update inside of the stored procedure. Please take a reference to two related articles below:
Update Tables with Reporting Services – T-SQL Tuesday #005
SQL Server: Using SQL Server Reporting Services to Manage Data
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Merge two column value in single column
Team,
I have a requirement where in I need to merge 2 column values in a single column.
ex. I have Percent_complete column in my table. and my table has only one record.
I need to query such that I need to store the values of percent_complete and (100- percent_complete) values in a single column.
ex
Percent complete has 30 value.
I need to select 30 and 70(100-30) both in a single column.
Thanks,SQL> select *
2 from tbl
3 /
PERCENT_COMPLETE
30
SQL> select abs(grouping(1) * 100 - max(percent_complete)) percent_complete
2 from tbl
3 group by rollup(1)
4 /
PERCENT_COMPLETE
30
70
SQL> select nvl(percent_complete,100 - max(percent_complete)) percent_complete
2 from tbl
3 group by rollup(percent_complete)
4 /
PERCENT_COMPLETE
30
70
SQL>
SY. -
Combine 2 specific column values into one column
Is there an easy solution to combine column values that is in a group?
In my report I have 1 column group named Activity_Area which has 5 different values Activity 1, Activity2...Activity5.
Let's say I want to merge Activity 4 and Activity 5 and call it ActivityX and gives me the output as below
Activity 1 | Activity 2 | Activity 3 | ActivityXHi Jhonny86,
According to your description, you create a field in database and it contains five values. Then you want to only display four values in report column group, and the last two values should be replaced by “ActivityX”, right?
In your scenario, you can create an table like below:
create table Act(id int,activity varchar(99))
insert into Act select 1,'Activity 1'
insert into Act select 2,'Activity 2'
insert into Act select 3,'Activity 3'
insert into Act select 4,'Activity 4'
insert into Act select 5,'Activity 5'
Then query the table with code like below in query designer, then add the field [Act] into the column group.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Calculating a count of rows where value matches another column value in the same table
Hi,
I'm struggling to do something in DAX that seems to me should be super easy (coming from a SQL world)!
That is to count all rows in column 1 where the value matches the current value for column 1?
E.g something like this:
[Col2]=Count of rows in [Col1] where value = this.[Col1]
Where the results are as in the table below:
Col1, Col2
A, 2
A, 2
B, 1
Anyone?
Martin Laukkanen
Nearbaseline blog - nearbaseline.com/blog
Bulk Edit and other Apps - nearbaseline.com/appsThanks, that's perfect!
I knew it had to be something so simple, but after spending over an hour banging my head against those exact functions I couldn't get anything working!
Martin Laukkanen
Nearbaseline blog - nearbaseline.com/blog
Bulk Edit and other Apps - nearbaseline.com/apps -
Mapping different same column value into different column based on conditio
Hi experts,
We have source as Oracle tables and target also Oracel tables.
Source
Column1|Column2|Column3
Target
trg1|trg2
I need to
insert the value of Column1 into trg1 where column2='xxx'
insert the value of column1 into trg2 where column3='yyy'
After giving the conditions on the mapping, the where conditions are getting clubed with and and I am getting different value than what is excepted. Like the similar way I have the same scenario for most of the columns in my target table. Suggest me how to do it.
Thanks in advance.Hi,
I tried the mapping but getting duplicate records.
case1: Only AND condtion is getting applied automatically as per the joins between tables..i m not able to change the AND to OR condition since there are three table joins.
case2: when i try to execute the separate query for the column, i getting the values once put in case statement only NULL values are getting fetched.
As all my target mapping are like this...lot of issues are getting raised while fetching records...
I have given my scenario once again below.
src1
col1
src2
col1
col2
col3
col4
src3
col1
tar1
col1
col2
mapping given are
tar1.col1 = select src2.col3 where src2.col1='xxx' and src2.col2='yyy' and src2.col4=src1.col1
tar1.col2 = select src2.col3 where src2.col1='aaa' and src2.col2='bbb' and src2.col4=scr2.col1
Kindly suggest how to do the mapping in details...I am stuck bcoz of this mapping......thanks in advance.
Edited by: siva on Nov 23, 2011 12:34 PM -
Get column value for specific columns
I want to change the default behavior of a IKM. In a specific step, I need to call a PLSQL procedure inside the loop below, and that procedure will substitute the insert clause. The procedure uses only some attributes, and I need to check the name of each one when I use the getColList method.
for aRecord in myCursor loop
insert into <%=snpRef.getTable("L","TARG_NAME","A")%>
<%=snpRef.getColList("", "[COL_NAME]", ",\n\t\t\t", "", "((INS AND (NOT TRG)) AND REW)")%>
<%=snpRef.getColList(",", "[COL_NAME]", ",\n\t\t\t", "", "((INS AND TRG) AND REW)")%>
values
<%=snpRef.getColList("", "aRecord.[COL_NAME]", ", \n\t\t\t", "", "((INS AND (NOT TRG)) AND REW)")%>
<%=snpRef.getColList(",", "aRecord.[COL_NAME]", ", \n\t\t\t", "", "((INS AND TRG) AND REW)")%>
end loop;
For example, to call the procedure I do that: schema.proc_1(col1, col2, col3). However, I have more than 3 columns, and I need to restrict them when I use the getColList method. I would like to know if there is a way to get only specific columns, giving these names. I pass the name of the column, and the method should return its value. Can I use the getColList to do that? Is there any other way to do that?Hi Luciene,
You can use the UD flags to do this. If you click on one of your mappings in the Diagram tab of your interface you will notice several UD flags (UD1 to UD5) you can use those to flag the columns you want to use in proc_1.
To summarize:
- at the interface level flag the columns you want to use in your PL/SQL code -> check UD1 for all of them
- modify your IKM code:
<%=odiRef.getColList(",", "COL_NAME", ",\n\t\t\t", "", "((INS AND TRG) AND REW AND UD1)")%> <- retrieve columns flagged with insert, not read only, mapped on target and with UD1 flagged. The "AND UD1" part can be used in other getColList.
Hope this helps.
Thanks,
Julien -
Single column value into two column of report
Hi frnds,
I have a column of Adress in my databse table from where i have to fetch values and show it a report
able to get report but showing in single column if i take a printout paper will be wasted so I thought of passing these values to two different columns
please help me in giving some suggestionsIn Oracle 9 you can get rid of the regex functions and use traditional SUBSTR, INSTR and REPLACE:
ABSOLUTELY NOT TESTED...
SELECT col1,SUBSTR ( ','||col2||',', instr(','||col2||',',',',lvl)+1,instr(','||col2||',',',',lvl+1)-instr(','||col2||',',',',lvl)-1)
FROM table_name,
(SELECT LEVEL lvl
FROM (SELECT MAX (LENGTH (REPLACE ( col2, ',',''))) mx
FROM table_name)
CONNECT BY LEVEL <= mx + 1)
WHERE lvl - 1 <= LENGTH (REPLACE ( col2, ',',''));Max -
Split one column value into two columns using t-sql
Hi All,
I have one varchar column in a table.
Col1
ABC-12C4
BC-A345
CD
XYZ
How to split this into two columns like this using t-sql
Col1 Col2
ABC 12C4
BC A345
CD
XYZ
Thanks,
RH
sqlassuming a static delimiter, and the split will end up with a max of 2 columns, something like this would work. basically you just need to determine where the delimiter is, and then use the left and right functions to find the 2 pieces.
declare @t table(value varchar(10))
insert into @t(value)
values
('ABC-12C4'), ('BC-A345'), ('CD'), ('XYZ')
select
case
when charindex('-', value) != 0 then left(value, charindex('-', value) - 1)
else value
end as col1,
case
when charindex('-', value) != 0 then right(value, len(value) - charindex('-', value))
else ''
end as col2
from @t -
How to replace the string of column value with other column value in same table
I have a temp table which contains
Id Name CTC Address Content
1 Ross $200 6th block Dear #Name your CTC is #CTC and your address is #address
2 Jhon $300 1oth cross Dear #Name your CTC is #CTC and your address is #address
Now i want to select content so that it should get replace with the respective columns and final output should come like this
Dear Ross your CTC is 200 and your address is 6th block
Dear Jhon your CTC is 300 and your address is 10th cross
Kindly suggestI think RSingh suggestion is ok ... what do you mean by another way? ...maybe something more generic?
maybe build a table whith the list of col you need to "replace" and dinamically build the replace query ...
declare @colList table(colName varchar(100))
insert into @colList
select 'name'
union all select 'ctc'
union all select 'address'
declare @cmd varchar(2000)
select @cmd='select '+ (select 'replace(' from @colList for xml path('') +' content '+
(select ',''#'+ colName +''', '+ colName +')' from @colList for xml path(''))
+' from YOURTABLENAME '
exec (@cmd)
or your request was different ?
Maybe you are looking for
-
Oracle and "Maximum open cursors exceeded"
Hi, I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA transactions and the 9.2 drivers are buggy in that respect, we are using the 9.0.1 thin drivers delivered with weblogic. The problem I have is that after a while, we get
-
I didn't illegally download the file. I go to the University of Oklahoma and they offered a free download of Windows 8 to students. I downloaded the installation file, but Bootcamp won't let me install Windows 8. What do I do?
-
Wat is the use of Advance tab in obiee
hi all , What is the use of advance tab , and that xml thing .. can any one tel me about it Thanks
-
How can I view a screenshot I received in an email without it being blurry?
I received a screenshot as an attachment in an email. How can I view it, and zoom in, without it being blurry? Any help is appreciated.
-
DV file messed up clip when doing speed conversion
I tried to change speed and it tells me it needed to convert the clip first. The problem is that after converting the clip, the resulting clip is low-res and jaggie. I noticed that it creates a new .mov clip for the project while original .dv file is