Select distinct for a date column in present. service when creating prompt
hi all
I am trying to create some new prompts in my answers and I have the following problem. When I try to create a new prompt on a date column ( for example Modification Date), when I try to run this report on this prompt it is displaying the same date a lot of times ( for example 2/4/11 it is being displayed 4 times).
Is there any way i can change this, so to display distinct dates?
Thank you and best regards
Hi Deva
I am trying to use this, but in the system are being saved the date + hour.
When i try select distinct modification date from My_view, i still have the same dates because they have different hours.
When i try select disctinct to_date(modification_date)..... I am having an error in BI.
Please help me to solve this issue.
Regards
Similar Messages
-
"select distinct" from itab data?
Hi anyone know how to do a "select distinct" from itab data and do some calculation.
For example:
This is my itab result data:
Col1 | Col2 | Col3 | col4
123 |000010 |a | 10.00
123 |000010 |b | 2.00
123 |000010 |c | 3.00
123 |000020 |a | 10.50
123 |000020 |b | 2.50
123 |000020 |c | 3.50
123 |000030 |a | 50.00
123 |000030 |b | 6.00
123 |000030 |c | 7.00
I need to do some calculation of a value a - (b value + c value) = x value and x value update back to value a col where the value of a, b, c must be match of col2.
ideally return 000010: x value = 5.00
000020: x value = 4.50
000030: x value = 37.00
How can I able to differential the data from cols2?
aish.hi,
u can do this:
loop at itab.
loop at itab into wa_itab where col2 = itab-col2. " process all 10's, 20's
....do ur codition chk n calculations here " populate the data into new itab
endloop.
delete itab where col2 = itab-col2. " after processing delete them.
endloop.
do the calculations and populate into new internal table in the loop itself. -
Data Federator XI 3.0 using DB2 VARCHAR FOR BIT DATA Column?
We have a column in a DB2 database that is defined as VARCHAR(16) FOR
BIT DATA.
We are using the suggested IBM JDBC driver, db2jcc.jar, against a DB2
OS/390 8.1.5 version database.
The Datasource column displays a data type of NULL, indicating the DF
does not understand or cannot handle this IBM data type.
We have two issues.
First, target tables are not able to return any columns, regardless if
we exclude columns defined as NULL as mentioned above. We see the
'Wait' animation for a very long time when we use the 'Target table
test tool' option. Selecting to display the count only, returns zero.
We are able to fetch and view non-NULL column data when using the
'Query tool' under the Datasource pane.
I also get the same result when using the 'My Query Tool' in Server
Administrator; a selection agains the sources returns data while
selecting from a target table returns no data. Also, a 'select
count(*)' returns zero.
The second issue is in mapping a relationship between two DB2 tables
where the join is between two columns of the above mentioned type
(NULL).
The error we get back when we use "Show Errors" is "The types
'NULL' (in 'S1.PLANNEDGOALID') and 'NULL' (in 'S2.PLANNDEDGOALID') are
not compatible.". When reviewing the relationship, a dashed red line
appears instead of a solid grey line between the two tables in the
"Table relationships and pre-filers" section of our mapping pane.
The following query returns an error via the Server Administrator
Query Tool; "Types 'NULL' and 'NULL' are not compatible for operator
'=' (Error code : 10248)".
select count(*)
from
(select s1.CASEID, s2.PLANNEDGOALID, s2.NAME, s2.PLANNEDGRPSTTYCD
from "/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" AS s1
,"/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" s2
where s1.PLANNEDGOALID = s2.PLANNEDGOALID)
Here are the properties settings in the Resource Connector Settings
for jdbc.db2.zSeries we are using.
capabilities: isjdbc=true;orderBy=false
driverLocation: drivers/db2jcc_license_cisuz.jar;drivers/db2jcc.jar
jdbcClass: com.ibm.db2.jcc.DB2Driver
sourceType: db2
supportsCatalog: no
urlTemplate: jdbc:db2://<hostname>[:<port>]/<databasename>
Here are the Connection parameters as defined for the datasource in DF
Designer.
Defined resource: jdbc.db2.zSeries
Jdbc connection URL: jdbc:db2://DB2D03:50000/CMFSREPT
Authentication: Use a specific database logon for all Data Federator
users.
User Name: x
Password: hidden
Login domain: -- Choose a defined login domain --
Supports Schema: checked
Schema: is empty
Prefix table names with schema name: checked
Supports catalog: unchecked
Prefix table names with the database name: unchecked
Table types: TABLE and VIEW
So, the following is the two questions we require answers for...
Is this a limitation of Data Federator?
Is there a work around short of changing the datatype in the database.Hi Darren,
The VARCHAR() FOR BIT DATA is a binary data type and Data Federator does not support binaries. But if in your case, it makes sense to map this column to a VARCHAR data type you can configure the DB2 connector to view this column as a VARCHAR.
Your column can be mapped explicitly to a data type of your choice using a property: castColumnType.
This property can be set updating the resource you selected when you registered you DB2 data source.
If the resource is "jdbc.db2", then:
1. Launch Data Federator Administrator
2. Click on "Administration" tab
3. Click on "Connector Settings"
4. Select the right resource: "jdbc.db2"
5. Click "Add a property"
6. Select "castColumnType"
7. Set its value to: VARCHAR() FOR BIT DATA=VARCHAR
8. Click on Ok
You should see this column as a VARCHAR.
Regards,
Mokrane
PS: For the target table issue, we have forwarded your mail to the Data Federator Designer team. -
Query to select value for max date from a varchar field containing year and month
I'm having trouble selecting a value from a table that contain a varchar column in YYYY-MM format.
ex.
Emp_id Date Cost
10264 2013-01 5.00
33644 2013-12 84.00
10264 2013-02 12.00
33644 2012-01 680.0
59842 2014-05 57.00
In the sample data above, I would like to be able to select the for each Emp_id by the max date. Ex. For Emp_id 10264, the cost should be 12.00.create table test (Emp_id int, Date varchar(10), Cost decimal (6,2))
insert into test values(
10264, '2013-01', 5.00 ),
(33644, '2013-12', 84.00 ),
(10264, '2013-02', 12.00 ),
(33644, '2012-01', 680.0 ),
(59842, '2014-05', 57.00 )
Select Emp_id,[Date],Cost FROM (
select *,row_number() Over(Partition by Emp_id Order by Cast([Date]+'-1' as Datetime) Desc) rn
from test)
t
WHERE rn=1
drop table test -
Help:Using Order by for a date column fetching wrong results
Hi all,
In my table I am having a date column which is having values
13/06/2007 09:24:00
31/05/2007 10:30:00
I am selecting this column with some other columns using order by at the end by giving the date column.
But I am getting rows in reverse order like above. I am using to_char(start_time,'dd/mm/yyyy hh:24mi:ss') in the select.
If I give to_date(start_time) in the order by the values are fetching correclty.But I was not allowed to use to_char in the select statement.
Kindly suggest me where it went wrong.
Thanks in advance.Hi , Thanks for the update. Actually that column was an Oracle DATE type. Earlier I gave simply that column name alone in the order by clause. That is getting falied only if the 2 entries falls in different months. Otherwise that is perfect.
So I gave to_date in the order by. But now I am facing a problem in the selecing that column. -
Select distinct record based on column
Hello All,
I have a table that has more than one row as Detail for a single invoice number(screenshot below). When I create report based on this table, I get multiple rows for single invoice. I mean Invoice 000027 shows up with 5 different rows on the SSRS report.
Is there a way I could display a single row for a single invoice? Any thoughts on this will be greatly appreciated. Thanks.
Regards,
Amol
eport )Thank you all for your suggestions. The issue is how can I get single distinct columns after joining 2 tables (InvoiceHeader & InvoiceDetail). I am using following query in my dataset.
SELECT DISTINCT I.recid, I.InvNumber, D.Detail, I.CompanyName, I.Addr1, I.SalesRep, I.JobNumber, I.Status, I.InvDate, I.TotalInvAmount
FROM InvoiceHeader AS I INNER JOIN
InvoiceDetails AS D ON I.InvNumber = D.InvoiceNumber
WHERE (I.InvNumber = @InvoiceNumber) AND (I.InvDate >= @StartDate) AND (I.InvDate <= @EndDate) AND (I.CompanyName IN (@Customer)) AND (I.Status IN (@Status)) OR
(I.InvDate >= @StartDate) AND (I.InvDate <= @EndDate) AND (I.CompanyName IN (@Customer)) AND (I.Status IN (@Status)) AND (I.JobNumber = @JobNo) OR
(I.InvNumber = @InvoiceNumber) AND (I.InvDate >= @StartDate) AND (I.InvDate <= @EndDate) AND (I.CompanyName IN (@Customer)) AND (I.Status IN (@Status))
AND (@JobNo = '') OR
(I.InvDate >= @StartDate) AND (I.InvDate <= @EndDate) AND (I.CompanyName IN (@Customer)) AND (I.Status IN (@Status)) AND (I.JobNumber = @JobNo) AND
(@JobNo = '') OR
(I.InvDate >= @StartDate) AND (I.InvDate <= @EndDate) AND (I.CompanyName IN (@Customer)) AND (I.Status IN (@Status)) AND (@JobNo = '') AND
(@InvoiceNumber = '')
ORDER BY I.InvNumber DESC
Thanks again.
Amol -
Hi,
I want select only distinct column of one column while at the same time displaying the other column attributed to the selected column.
e.g. select name
from student
where name in
(select distinct name from student)
and processing_date >= '20070701'
and processing_date < '20070702'
this list all the similar rows and the distinct. Please assist. ThanksI'm sorry, but I am still a confused. Your current query, as written, is logically equivalent to...
SELECT name, address
FROM student
WHERE processing_date >= '20070701'
AND processing_date < '20070702';since selecting the DISTINCT names from the same table will match on every row.
Are you looking for the DISTINCT names and addresses?
SELECT DISTINCT name, address
FROM student
WHERE processing_date >= '20070701'
AND processing_date < '20070702';Or are you looking for output like this?
Bill Johnson 123 Main Street
456 West Lane
John Doe 222 Hill Stree
888 East AvenueAgain, some sample output would be helpful.
Greg -
Select distinct('more than one column') from ....
Why does this sql statement not work:
select distinct(column_a, column_b, column_c), empno
from emp;
How can I 'select distinct' using more than one column.Actually, DISTINCT applies to all columns in the result.
Distinct is not a function, you cannot do distinct(column1, column2, ...).
As a matter of fact it doesn't make sense to expect distinct applies to only one column, because you do not specify any criteria on how to select the values for the second column.
A final note: you can do distinct(column1), column2, but this will still apply to both columns!
Here're some examples that will all return both rows from the set, where set is: (1,1), (1,2):
select distinct val1, val2
from
select 1 as val1, 1 as val2 from dual
union all
select 1 as val1, 2 as val2 from dual
select distinct val1||'-'||val2
from
select 1 as val1, 1 as val2 from dual
union all
select 1 as val1, 2 as val2 from dual
select distinct(val1), val2 -- this is very misleading. distinct still applies to both columns
from
select 1 as val1, 1 as val2 from dual
union all
select 1 as val1, 2 as val2 from dual
Edited by: user4010726 on Dec 1, 2009 11:06 AM
Edited by: user4010726 on Dec 1, 2009 11:07 AM -
Strange behaviour in alv output display for a date column!
hi friends,
my alv output list display contains a column for budat (posting date), if this field has no value, then it displays a blank cell (space) in the output in my user login...but when the same report is run in another user login, even though the value of the column is null, it displays 00000000 (8 zeroes) rather than displaying a blank cell...i have set the field catalog property NO_ZERO = 'X'; is this property has anything to do with authorization to achieve its funcionality? am not sure...this is strange, as it is the same report, same field catalog that is being used..need some inputs on this
thanks in advance
SathishThere are 2 solutions for an adhoc solution you can change the field to a char10 field, this will solve your immediate problem of the 0 display. For a permanent solution you can check the user profile setting for the date for you as well as the concerned user.
Hope That Helps
Anirban M. -
Select Distinct (More than one column)
Hi All,
I have the following SQL statement written in MySQL that returns only one row per MODCODE with the associated DEPTCODE of AE:
SELECT DISTINCT
EL_MODULE.DEPTCODE, EL_MODULE.MODCODE, EL_MODULE.MODNAME, EL_MODULE.MODLEVEL, EL_DEPTLEVEL.DEPTLEVELHEADER
FROM EL_DEPTLEVEL, EL_MODULE
WHERE EL_MODULE.MODLEVEL = EL_DEPTLEVEL.LEVELCODE AND EL_MODULE.DEPTCODE='AE' ORDER BY EL_MODULE.MODLEVEL
However when I attempt to use this in oracle it returns three rows, could somebody point out what it is I need to change to get this working correctly in oracle.
Hope someone can help.
JonDuplicates? No way! This query returns unique comibination of
EL_MODULE.DEPTCODE,
EL_MODULE.MODCODE,
EL_MODULE.MODNAME,
EL_MODULE.MODLEVEL and
EL_DEPTLEVEL.DEPTLEVELHEADER
Cheers
Sarma. -
Best choice for a date column in forms
Hello,
I want to know what is the best choice for a date field that the user have to enter manually. I read on a other post that a calender control is not directly implemented in forms 9i. So what is the best choice to be "user friendly" with a date field in a form?
thanks in advance.Hi
Don't know if this would be much use to you, but I wrote this function 'Check_Date' a while back to check whether the user had typed something which could be interpreted as a date. You'd make your date field into a Text Item, and include a call to this function (which could be in your form, or in a library) in the WHEN-VALIDATE-ITEM trigger on the item, ie:
IF NOT check_date(:ITEMS.date_item1, NULL, NULL) THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;This would mean that the user could type 'T' or '*' for today, '+1' for tomorrow, '-7' for one week ago, or the date in a variety of formats. When they leave the field, the function tries to resolve what they've typed into a date, and sets the field to a date in the correct format.
('Display_Alert' is just a function to display a named alert with a message.) It can also be used to check that the date entered doesn't fall outside upper and lower bounds. Code follows:
FUNCTION Check_Date (text_in IN OUT VARCHAR2,
lower_bound_in IN DATE,
upper_bound_in IN DATE)
RETURN BOOLEAN IS
first_letter VARCHAR2(1) := SUBSTR(text_in, 1, 1);
date_ok BOOLEAN;
this_date DATE;
date_diff NUMBER(8);
output_format VARCHAR2(12) := Get_Application_Property(BUILTIN_DATE_FORMAT);
TYPE date_format_table_type IS TABLE OF VARCHAR2(12)
INDEX BY BINARY_INTEGER;
date_format_table date_format_table_type;
BEGIN
--Set up table of date formats in order they'll be tested for
date_format_table(1) := 'DD-MON-RRRR';
date_format_table(2) := 'DD-MM-RRRR';
date_format_table(3) := 'DD-MM';
date_format_table(4) := 'DD-MON';
date_format_table(5) := 'YYYY-MM-DD';
date_format_table(6) := 'YYYY-MON-DD';
--Use of T, or * for today's date...
IF UPPER(text_in) IN ('T', '*') THEN
this_date := SYSDATE;
date_ok := TRUE;
--Look for use of +x/-x for number of days different from today
ELSIF first_letter IN ('+', '-') THEN
BEGIN
date_diff := TO_NUMBER(SUBSTR(text_in, 2));
IF first_letter = '+' THEN
this_date := SYSDATE + date_diff;
ELSE
this_date := SYSDATE - date_diff;
END IF;
date_ok := TRUE;
EXCEPTION
WHEN VALUE_ERROR THEN
--User has entered something like '+X', so not valid
date_ok := FALSE;
END;
ELSE
--Go through all the possible formats for date entry,
--if any give a valid date, then return that.
FOR ix IN date_format_table.FIRST..date_format_table.LAST LOOP
EXIT WHEN date_ok;
BEGIN
--Try creating a date using the format masks in the local
--table. If no good, this will throw an INVALID_DATE exception
this_date := TO_DATE(text_in, date_format_table(ix));
date_ok := TRUE;
EXCEPTION
WHEN OTHERS THEN
date_ok := FALSE;
END;
END LOOP;
END IF;
IF date_ok THEN
--Check for violation of lower/upper bounds on date
IF (lower_bound_in IS NOT NULL AND this_date < lower_bound_in) THEN
Display_Alert('info_alert', 'Date cannot be before '||TO_CHAR(lower_bound_in, output_format));
date_ok := FALSE;
ELSIF (upper_bound_in IS NOT NULL AND this_date > upper_bound_in) THEN
Display_Alert('info_alert', 'Date cannot be after '||TO_CHAR(upper_bound_in, output_format));
date_ok := FALSE;
ELSE
text_in := TO_CHAR(this_date, output_format);
END IF;
ELSE
Display_Alert('INFO_ALERT', text_in||' is not a valid date !!');
END IF;
RETURN date_ok;
END;Hope this is useful.
regards
Andrew
UK -
Support for xs:date types in web services generated from EJB components
I need to generate a Web Service from an EJB session bean based upon EJB entities generated from the Oracle 11g database that contain DATE type columns.
JDeveloper creates java.sql.Timestamp types in the EJB Session bean and this results in an exception error when I try to generate a web service from this bean via webservice annotations:
java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.sql.Timestamp does not have a no-arg default constructor
I expected the web service wizard to generate argument types xs:dateTime or xs:date so this was an unwelcomed surprise.
I tried manually adding a method to the session bean with java.util.date arguments and had no problems with the web service wizard that correctly created xs:dateTime arguments. Is there any particular reason why the EJB wizard does not generate java.util.date arguments or handle java.sql.Timestamp without failing with an exception?
Since I begin with database tables and generate EJB entity classes and then web services with the Jdeveloper wizards it seems to me that there is a problem here in JDeveloper. Would you agree?
There are several possible more or less appealing workarounds, such as doing manually adding methods to the EJB facade with java.util.date arguments and doing the conversion from/to java.sql.timestamp manually. Is this a reasonable approach or does JDeveloper support date/time for Date columns in some other way that I have missed?
Very Grateful for any comments or suggestions.
Edited by: user10601664 on May 2, 2009 1:14 PM
Edited by: user10601664 on May 2, 2009 1:43 PMCheckout this example:
http://www.manojc.com/?sample3
public class HelloWorldService{
* @wlws:exclude
public void dontExpose(){
Regards,
-manoj
http://manojc.com
"Jacob Anderson" <[email protected]> wrote in message
news:4036581e$[email protected]..
>
hello,
I created the descriptor file for a web service that had a protectedmethod in
it and noticed the protected method showed up in the descriptor file!Should
the "source2wsdd" task only output PUBLIC methods as service actions? Isthere
any way to specify methods to be 'ignored' when generating the webservices descriptor
file?
here was the generated descriptor XML:
<web-service name="BindingService"
protocol="https"
style="document"
targetNamespace="http://www.foo.com/ws/BindingService/"
portName="BindingServicePort"
uri="/BindingService"
portTypeName="BindingServicePort">
<types>
</types>
<wsdd:type-mappingxmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdd="http://www.bea.com/servers/wls70">
<wsdd:type-mapping-entrydeserializer="weblogic.xml.schema.binding.internal.builtin.DocumentCodec"
type="xsd:anyType"
class-name="org.w3c.dom.Document"
serializer="weblogic.xml.schema.binding.internal.builtin.DocumentCodec">
</wsdd:type-mapping-entry>
</wsdd:type-mapping>
<components>
<java-class name="BindingService"
class-name="com.arrow.ws.vendor.BindingService">
</java-class>
</components>
<operations>
<operation name="getConfigName"
component="BindingService"
method="getConfigName()">
<params>
<return-param xmlns:typeNS="http://www.w3.org/2001/XMLSchema"
location="body"
type="typeNS:string"
name="result"
class-name="java.lang.String">
</return-param>
</params>
</operation>
</operations>
</web-service> -
Presentation service caching (in prompt dropdowns)
I am implementing a BI application to execute reports on some fast-changing databases. To avoid the risk of stale data, I have disabled caching in BI, but there seems to be a different cache underlying the prompts which has not been disabled. I have a series of drop downs which must always be an immediate reflection of the database, and instead it is clear that these drop downs are based on cached data. Does anyone know how this cache is managed?
I believe the presentation service is responsible for this cache, which I would like to disable. Is there an interface to control this behavior?Is oc4j running? otherwise start it form Start>All Programs>Oracle Business Intelligence>Start OC4J.
Then start Presentation services (sawserver.exe in the OracleBI/web/bin directory or from Control Panel>Administrative tools> Services
Then try the wbe URL -
Data target is not available when creating an info package in BW
Hi,
I am not sure how, but I have accidentally deleted the info packages for one of the info sources. I have created init package successfully, but when I try to create a delta info package for the data mart, the data target( which is an info cube) is not appearing in the data target tab.
Any help in this issue is higly appreciated.
Thanks
PrashantPRASHANT ASOPA , did you find a solution to this - I am facing a similar situation! I have tried almost everything including deleting and recreating the update rule, recreating the export datasource, activating everything a couple of times and of course cretaing and deleting info packages, but no matter what I do I can't get the system to recognize the data target.
The "funny" thing is that everywhere else, even in the "Show data flow" everything looks right! -
How to set null value for a date column using database adapter
Hello,
I have a table wih 3 columns
(id NUMBER,
modified_on DATE
contentText VARCHAR2)
I have a row wih theses values (1, 20/03/2010 16:30, 'coucou')
I want use a DB adapter in a BPEL process to change the value of column modified_on to (null). I'm using the out-of-he box "update" method (no custom sql, nieher "insert or update (merge)" method)
- If I only set values of "Id" and "contentText" -> insert is done but I missed the modification of "modified_on" to (null)
- If I set all values and use expression '' (2 single quote without any space) for modified_on I got an error on update
BWriteInteractionSpec Execute Failed Exception.
update failed. Descriptor name: [DBUTFORM.TForm]. [Caused by: String index out of range: 10]
Caused by Exception [TOPLINK-3001] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.ConversionException
Exception Description: The object [xs:datetime], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp].
Internal Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 10.
Thanks for help1008318 wrote:
its my personal need..then it is a very bad personal need. DATE is not an appropriate type to be using for a primary key, as it cannot be guaranteed to be unique, especially when inserting multiple rows at once.
You would be better working to business needs and implementing correct technical solutions to those needs, than to just do things based on your personal needs.
Maybe you are looking for
-
CUSTOS: COMO SE DÁ SEU CÁLCULO NO R/3?
Amigos, Gostaria de saber como se dá o cálculo de custos de materiais no SAP R/3. Inclui-se os gastos operacionais ou não? E o custo direto e indireto o que usar pra esse tipo de cálculo de custo? Procurei na Biblioteca do Site mas, nada descobri, a
-
Find my iPhone has changed recently. Now how do I centre it?
I use "Find my iPhone" to track where my wife is, which can be very useful for both of us. There now seems to be no way of centering the position of the 'phone, once the map has been moved slightly. If the 'phone has move a lot since I last looked at
-
Uploading the Notes text pool using Conversion method for Dispute Cases.
Hi Everybody, Please can anybody give the solution for uploading the Notes textarea in tab(Notes in dispute cases) using BDC method for transaction FDM_AUTO_CREATE(Dispute Cases). Here, the problem is, Notes is text area which is not having proper re
-
Is it possible to use portal service written in Java?
Hello, I've written a certain portal service in Java and deployed it to the portal and it is working OK. My question is if it is possible for .NET developers to use it and it's method in their projects as I am using in my Java and DynPro projects. Ro
-
How do I get the group icon to show up in the upper right hand corner of my contacts. Mine just has the partial circle with the arrow on one end