Sql statement not showing right result set
Hi everyone,
I have a statement :
select to_date(extract (day from to_date(begin_datum,'yyyy-mm-dd'))||'-'||extract (month from to_date(begin_datum,'yyyy-mm-dd'))||'-'||
extract(year from sysdate),'dd-mm-yyyy') from fus_medewerkers;
which returns following result:
12-FEB-09
07-DEC-09
22-NOV-09
21-MAY-09
26-FEB-09
17-DEC-09
01-SEP-09
17-DEC-09
04-APR-09
07-JUN-09
23-MAY-09
29-MAY-09
13-AUG-09
18-MAR-09
01-NOV-09
12-AUG-09
06-JAN-09
01-MAR-09
02-AUG-09
16-AUG-09
06-NOV-09
23-MAR-09
06-MAY-09
01-NOV-09
01-MAR-09
16-AUG-09
01-JAN-09
01-DEC-09
01-OCT-09
01-OCT-09
01-OCT-09
01-APR-09
01-APR-09
08-DEC-09
01-APR-09
01-AUG-09
14-JUN-09
02-JUL-09
01-APR-09
10-JAN-09
15-MAR-09
07-APR-09
29-JAN-09
16-JUN-09
21-OCT-09
I now put a condition in my original statement as follow:
select to_date(extract (day from to_date(begin_datum,'yyyy-mm-dd'))||'-'||extract (month from to_date(begin_datum,'yyyy-mm-dd'))||'-'||
extract(year from sysdate),'dd-mm-yyyy') from fus_medewerkers
where sysdate <= to_date(extract (day from to_date(begin_datum,'yyyy-mm-dd'))||'-'||extract (month from to_date(begin_datum,'yyyy-mm-dd'))||'-'||
extract(year from sysdate),'dd-mm-yyyy');
The result is:
07-DEC-09
22-NOV-09
17-DEC-09
01-SEP-09
17-DEC-09
13-AUG-09
01-NOV-09
16-AUG-09
06-NOV-09
01-NOV-09
16-AUG-09
01-DEC-09
01-OCT-09
01-OCT-09
01-OCT-09
08-DEC-09
21-OCT-09
As you can see the row with sysdate (12-AUG-09 ) in my first result is not shown in the second result set.
Can someone please tell me why this is so and how I could solve this problem?
Regards,
Diana
sysdate contains time even if it's not shown. e.g. at 14:43:22 on Aug 12th 2009, sysdate would have a value of 12-AUG 2009 14:43:22, but unless you have changed your NLS_DATE_FORMAT setting you would only see the date portion of it.
When comparing a date value to sysdate you may need to truncate one or both values depending on the results you are looking for.
e.g.
the only difference between these two queries is that I truncate sysdate in one of them:
with t1 as (select 1 id, to_date('12-AUG-2009','dd-mon-yyyy') dt from dual
union all select 2, to_date('12-AUG-2009 14:23','dd-mon-yyyy hh24:mi') from dual
select sysdate, t1.* from t1 where sysdate <= dt
SYSDATE ID DT
12-AUG-2009 11:38:21 2 12-AUG-2009 14:23:00
1 rows selected
with t1 as (select 1 id, to_date('12-AUG-2009','dd-mon-yyyy') dt from dual
union all select 2, to_date('12-AUG-2009 14:23','dd-mon-yyyy hh24:mi') from dual
select trunc(sysdate), t1.* from t1 where trunc(sysdate) <= dt
TRUNC(SYSDATE) ID DT
12-AUG-2009 00:00:00 1 12-AUG-2009 00:00:00
12-AUG-2009 00:00:00 2 12-AUG-2009 14:23:00
2 rows selected
Similar Messages
-
Set in Excel using ORDER MDX statement not showing correct results on PowerPivot model
I have defined a set in Excel 2013 with this syntax:
order(Topcount([Company].[Company].[Company].members,
10,
[Measures].[Sum of TotalValue]),[Measures].[Sum of TotalValue]
,DESC)
The order statements is not properly Applied. Order by name is still active. Would appreciate your help, if have I done something wrong or is this a bug?Ok in the meantime I have solved this myself. In the field settings is an option for "Automatically order and remove duplicates..." which is turned on by default and overrules specific order statements in the set. I am not quite sure why but as long as
you know about it, this can be addressed by turning off. -
Avoid JDBC sender error: Execute statement did not return a result set
Hi!
My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
I do not see how to change the stored procedure to avoid this error.
Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
Thanks for any input!
Regards,
Oeystein EmhjellenHi Oeystein Emhjellen.
The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
Like a SELECT Statement:
If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
Ask to your database team.
I hope it helps you.
Bruno. -
After upgrading to iOS 8 on my iPhone 5, the weather app does not show up results for any of the Indian States/cities. Can Apple look into this or does anyone have a solution to this.
Swipe from bottom of days listed ("Wednesday, Thursday, Friday, etc") upwards. I thought it was gone too but it's still there~just takes different way to access it.
-
The statement did not return a result set in ireport
Hi,
I am Building a Report in iReport(Jasper Reports). I called a stored procedure from iReport by passing a parameter in Query Editor. I am getting an exception saying "The statement did not return a result set". When
i use Temp Tables in stored procedure i am getting the exception.
If there is no temptable in Stored procedure there wont be any exception.
This is my Stored procedure
Create PROCEDURE [XUSP_REPORT_SOPRINT] @BNUM VARCHAR(20) AS
BEGIN
DECLARE @FQTY BIGINT
DECLARE @ITNAME VARCHAR(100)
DECLARE @COUNT INT=0
DECLARE @COUNT1 INT=0
CREATE TABLE #BILL_PRINT(
[BNUM] [varchar](20) NOT NULL,
[CNAME] [varchar](30) NOT NULL,
[CNUM] [int] NOT NULL,
[ITNAME] [varchar](100) NOT NULL,
[ITEM#] [int] NOT NULL,
[QTY] [int] NOT NULL DEFAULT 0,
[UNIT] [varchar](5) NOT NULL,
[PRICE] [float] NOT NULL DEFAULT 0,
[BASIC] [float] NOT NULL DEFAULT 0,
[DISCOUNT] [float] NOT NULL DEFAULT 0,
[FRQTY] [int] NOT NULL DEFAULT 0,
[BADDR] [varchar](300) NULL,
[CADDR] [varchar](300) NOT NULL,
[BDATE] [datetime] NULL DEFAULT (sysdatetime()),
[BILLBY] [varchar](50) NOT NULL,
[ROUTE] [varchar](200) NULL,
[AMT] [float] NOT NULL DEFAULT 0,
[VAT] [float] NOT NULL DEFAULT 0,
[VAT AMT] [float] NOT NULL DEFAULT 0,
[AMT_AF_DISC] [float] NOT NULL DEFAULT 0,
[AMT_AF_VAT] [float] NOT NULL DEFAULT 0,
[TOT_DISC] [float] NOT NULL DEFAULT 0,
[ROUND_OFF] [float] NOT NULL DEFAULT 0,
[TOT_VAT] [float] NOT NULL DEFAULT 0,
[AMT_UNDER_VAT] [float] NOT NULL DEFAULT 0,
[NETT] [float] NOT NULL DEFAULT 0,
[TOS] [varchar](30) NULL DEFAULT 0,
[CDISC] [float] NOT NULL DEFAULT 0,
[SDISC] [float] NOT NULL DEFAULT 0
insert into #BILL_PRINT SELECT [BNUM]
,[CNAME]
,[CNUM]
,[ITNAME]
,[ITEM#]
,[QTY]
,[UNIT]
,[PRICE]
,[BASIC]
,[DISCOUNT]
,[FRQTY]
,[BADDR]
,[CADDR]
,[BDATE]
,[BILLBY]
,[ROUTE]
,[AMT]
,[VAT]
,[VAT AMT]
,[AMT_AF_DISC]
,[AMT_AF_VAT]
,[TOT_DISC]
,[ROUND_OFF]
,[TOT_VAT]
,[AMT_UNDER_VAT]
,[NETT]
,[TOS]
,[CDISC]
,[SDISC]
FROM [SALES_DETAILS] WHERE BNUM=@BNUM
CREATE TABLE #ITNAME_0
ITEM VARCHAR(100) NOT NULL,
FREE BIGINT NOT NULL
INSERT INTO #ITNAME_0 SELECT ITNAME,FRQTY FROM SALES_DETAILS WHERE FRQTY<>0 AND BNUM=@BNUM
--SELECT * FROM #ITNAME_0
SET @COUNT=(SELECT COUNT(*) FROM #ITNAME_0)
WHILE @COUNT!=0
BEGIN
SET @FQTY=(SELECT TOP(1) FREE FROM #ITNAME_0)
SET @ITNAME=(SELECT TOP(1) ITEM FROM #ITNAME_0)
SET @COUNT1=(SELECT COUNT(*) FROM #BILL_PRINT WHERE ITNAME=@ITNAME AND BNUM=@BNUM)
IF @COUNT1=2
BEGIN
UPDATE #BILL_PRINT
SET FRQTY+=@FQTY
WHERE ITNAME=@ITNAME AND QTY<>0
DELETE FROM #ITNAME_0 WHERE ITEM=@ITNAME AND FREE=@FQTY
DELETE FROM #BILL_PRINT WHERE ITNAME=@ITNAME AND QTY=0
END
SET @COUNT=@COUNT-1
END
--SELECT *FROM sales_details
SELECT *FROM #BILL_PRINT where bnum=@bnum
DROP TABLE #BILL_PRINT
DROP TABLE #ITNAME_0
END
Please help me out in this.
Thanks,
Shreyas MThis is a forum for Reporting Services (SSRS). If you're using Jasper reports then you should be posting in relevenat forums. I'm not sure there would be enough people with Jasper report experience here to help you out!
Anyways in SSRS when we use Temp tables in procedure it will throw exception in editor but when you save and run it will still work fine. Did you try saving it and executing report? Did the error still persisted?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
The operation is not allowed for result set type FORWARD_ONLY
Hi,
I am trying to use scroll insensitive resultset in following manner-
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("some sql here");
rs.last();
but the rs.last() throws this exception-
com.sap.dbtech.jdbc.exceptions.SQLExceptionSapDB: The operation is not allowed for result set type FORWARD_ONLY.
at com.sap.dbtech.jdbc.ResultSetSapDB.assertNotForwardOnly(ResultSetSapDB.java:2725)
at com.sap.dbtech.jdbc.ResultSetSapDB.last(ResultSetSapDB.java:557)
Database version: Kernel 7.5.0 Build 019-121-082-363
Driver Version: MaxDB JDBC Driver, MySQL MaxDB, 7.6.0 Build 030-000-005-567
This used to work with 7.5 version driver. Why this is failing with 7.6 driver, any clues?
Thanks,
VinodHi Vinod,
due to performance improvement when using forward only cursor we changed the default for the resultset type from TYPE_SCROLL_SENSITIVE to TYPE_FORWARD_ONLY starting with JDBC driver version 7.6. So I guess the exception comes from a statement where you didn't set the resultset type while creating it. Please check if all of the statements that you want to be scrollable have set the correct resultset type.
Regards,
Marco -
SQL STATEMENT NOT PROPERLY ENDED - HELP NEEDED
Can anyone tell me the error in this code, I get an error message sql statement not properly ended when I run it.
update MODT set rootobj=(SELECT REF(A) FROM
OR_COMP_T A
WHERE A.ID=O.ID)
AS OR_COMP_T_REF)
FROM OLD_MODT O where id = 1;Hi, here is the schema and the expected results.
=======================================================================================
CREATE TYPE OR_MODT_OBJ;
CREATE TYPE OR_MODT_OBJ_REF AS TABLE OF REF OR_MODT_OBJ;
=================================================
CREATE OR REPLACE TYPE OR_COMP_T_OBJ
(id number (6),
typ char (4),
SUPERID REF OR_COMP_T_OBJ,
MOD REF OR_MODT_OBJ);
=================================================
CREATE OR REPLACE TYPE OR_COMP_T_REF AS TABLE OF REF OR_COMP_T_OBJ;
=================================================
CREATE TABLE OR_COMP_T OF OR_COMP_T_OBJ
=================================================
CREATE TYPE OR_MODT_OBJ
(id number (6),
typ char (4),
rootobj REF OR_COMP_T_OBJ,
comp_tb OR_COMP_T_REF);
=================================================
CREATE TABLE MODT OF OR_MODT_OBJ
NESTED COMP_TB STORE AS COMP_TB_NESTED;
=================================================
INSERT INTO OR_MODT (ID,TYP,ROOTOBJ,COMP_TB)
SELECT ID,TYP,NULL,NULL FROM OLD_MODT;
INSERT INTO OR_COMP_T(ID,TYP,SUPERID,MOD)
SELECT ID,TYP,NULL,NULL FROM OLD_OR_COMP_T;
==================================================
There are two rows in OLD_MODT, and these two rows are to be inserted into OR_MODT.
They are:
Sample data in OLD_MODT are:
id, typ, rootobj
1 type1 1
2 type3 365
=================================================
Data from OLD_OR_COMP_T is to be inserted into OR_COMP_T as well, and likewise, it has a ref to OR_MODT, so the ref data was not inserted at the same time.
Now OLD_OR_COMP_T has a number of rows but attribute MOD for two of these rows os the rootobj for OR_MODT,
such that:
id typ superID mod
1 type4 NULL 1
2 type2 10101 1
3 type 20202 1
365 type2 NULL 2
366 type2 20202 2
I want to get the ID of OR_COMP_T where ID is 1 and where ID is 365. These values are to be in rootobj.
I also want to get the value of ID in OR_MODT to be placed in MOD of OR_COMP_T.
PLEASE HELP ME. -
Why this query does not show the result?
Why the query with the schema prefixed does not show the result and the query without schema display the correct results?
SQL> select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS';
select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS'
ERROR at line 1:
ORA-00933: SQL command not properly ended
SQL> select data_object_id,object_type from dba_objects where object_name='HR.JOBS';
no rows selected
SQL> select data_object_id, OWNER, object_type from dba_objects where object_name='JOBS';
DATA_OBJECT_ID OWNER OBJECT_TYPE
69662 HR TABLE
OE SYNONYM
SQL> SELECT USER FROM DUAL;
USER
SYSHi,
the column object_name refers to a object_name which is 'JOBS', the column owner refers to the owner 'HR', the value isn't stored together, so you have to select the two columns. It is the same behaviour as every other table/view. Have a look at the values in the view DBA_OBJECTS.
Herald ten Dam
Superconsult.nl -
Business rule not showing the result
When i am executing a business rule, it runs successfully but it does not show any result. But when i enter any amount in that specific cell where the BR should calculate the amount and then run the BR then it shows me the required result. What can be the reason for that?
We are on 11.1.2
and im making BRs through Calc Manager (Wizard Based)
Edited by: ar_aff on Mar 24, 2011 9:56 PMI think that's about Block problem (value of a cell). The BR can't open block automatically. In BR sorce usually used a command Set Createnonmissngblk on before calculating value;
-
Query not showing detailed result when run through query Designer or Portal
Hi,
There is one query which not showing detailed result while running through Query Designer or run in Portal.
But strange thing is that it is showing the detailed result when i run it through BeX Analyzer.
While all the other queries don't have this problem in system. All showing the correct detailed result.
If anyone have some idea on this issue plz let me know.
Regards,
Javed
Edited by: Javed Akhtar on Jul 7, 2009 3:59 PMHi,
We can do this setting in WAD. Please check the web template and try to remove that setting. When you have hierarchy then we can display only till certain level in portal, this setting is done in web template APIs, but in bex analyzer you can see all the detailed information.
Edited
Go through this thread for some more detailed information
http://help.sap.com/saphelp_nw2004s/helpdata/en/44/7b5f0a95ce12d0e10000000a422035/frameset.htm
Regards,
rik -
IOS 8: spotlight not showing wikipedia result snippets
hi
running 8.0.2.
iOS 8: spotlight not showing wikipedia result snippets.
it does show the static Search Wikipedia link however.
how to get the spotlight search snippets of wikipedia to show, as advertised?
thanksTurn Spotlight Suggestions on and off a few times. If it still doesn't work try a reset. Press and hold both the home and power buttons 10-15 seconds till the Apple logo appears. Release both buttons. Wait 15-20 seconds till your iPad starts on it's own.
I'm using a iPad but I can't see that making a difference. -
VL06I Inbound delivery monitor not showing correct results
Dears,
We are creating inbound deliveries on the basis of POs and creating GR via MIGO after eliminating movement type in line item catageory by using SPRO. For monitoring we would like to use VL06I but its not showing correct results.
Can anyone guid me ?
Regards,
FRYou can list all Inbound Deliveries by selecting "List Inbound Deliveries" Tab in VL06I
May be if you can little elaborate the issue -
I am using the sender jdbc sender adapter.
I had given the SQL Query:
EXECUTE xyz;
i am getting SQL Exception.
SQL Statement not allowed in adapter monitoring.
GauravHi,
Which database you are using ?
Are you executing the Stored Procedure ?
check out this for the syntax etc-
http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
Regards,
Moorthy -
Spotlight is not showing any results!
I just upgraded to Leopard and now my spotlight app will not show any results when typed upon. I have tried to re-index the volume through system pref. but it didnt work. Anyone know any other methods to get it back into shape? thanks
enter the following terminal commands form an admin account:
sudo mdutil -i off /
sudo mdutil -E /
sudo mdutil -i on /
please copy and paste them exactly as given. you'll have to enter your admin password (which you won't see) after the first command. that's normal.
the commands turn spotlight off, delete the index and turn it back on. -
QUnit not showing any results - VisualStudio 2013
In Mircrosofs book:
"Programming in HTML5 with JavaScript and CSS3" there is testing with QUnit.
Have done exactly as the book describes with in an example with an webcalculator in excersise 3.
But when I run the debugging with QUnit does not show any results.
It does not matter if I program an
error..nothing is displayed when I´m start debugging.
Only a blue line with the following:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
My question:
How do I make QUnit to show something?
I really appreciate your answer
:0)Hello,
Please post your question in ASP.NET forums here:
http://forums.asp.net/
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
I see in the task manager several itunes process are running but that is about it. Anyone else having this provlem? Thanks,
-
Adding leading zeros before data loaded into DSO
Hi In below PROD_ID... In some ID leading zeros are missing before data loaded into BI from SRM into PROD_ID. Data type is character. If leading zeros are missing then data activation of DSO is failed due to missing zeros and have to manually add the
-
Error loading plugins. AISaveForWeb.aip
The problem with my computer set to Adobe Illustrator CS5. 20/10/1910 after injection of regular updates adobovskih Illustrator crash when started starts at the registration window. Since I still trial version, then all these days to choose it and th
-
NoClassDefFoundError in Unsafe.ensureClassInitialized
Hi all I am getting a NoClassDefFoundError thrown by sun.misc.Unsafe.ensureClassInitialized(), but there is no indication of which class is not found (getMessage() returns null). Can anyone tell me how to find out which class it cannot find ?
-
Hello, I have an issue with two wlc 5508 in the same mobility group. We use TACACS to authenticate admins, with maximum privileges. When I want to configure cleanair, or some security functions (such as ACL, or password policies), I have an error mes