I am connecting to SQL Server via Spring in WebSphere. I have a piece of pretty simple dynamic SQL (below) that is throwing “The cursor was not declared.” One of the settings for the data source that seems relevant is the “select mode” is “cursor”. I’m not really sure what I need to do to resolve the error. edit The
Trigger created with compilation errors
I wrote this trigger to discount the top client in the database by 10% when a new purchase is made: However when i execute this statement i receive this message: Can someone please tell me what I am doing wrong? Thanks, Alex. UPDATE – Errors: Solution: Answer I don’t have your tables to hand so I can’t guarantee that I’ve
What characters are allowed in Oracle bind param placeholders?
Could anyone please point me to where the characters allowed for a bind variable name are listed? I’ve spent several hours digging through Oracle SQL docs to no avail. I mean “:id” in the following: …
How to Troubleshoot Intermittent SQL Timeout Errors
We’ve been having a few instances per day where we get a slew of SQL Timeout errors from multiple applications (System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.) We have over 100 different applications on our network, both web and desktop apps. Everything from VB6 and Classic ASP to
How to get the current effective date in Oracle?
I have a table like the following: TID TName EffectiveDate 1 A 2011-7-1 2 A 2011-8-1 3 A 2011-9-1 4 A 2011-10-1 5 B 2011-8-1 6 B 2011-9-1 7 B 2011-10-1 8 C 2011-9-1 If today is 2011-9-10, I wish the query result will be like this: TID TName EffectiveDate Status 1 A 2011-7-1 Invalid 2 A 2011-8-1 Invalid 3
Can all SQL queries be represented in Relational Algebra, Domain and Tuple relational calculus
My query includes a having and count or all in. How are these represented in RA/DRC/TRC? Would I have to simplify my SQL query even more? Here is a simplified example: empl(employee (primary key), …
SQL query to find distinct values in two tables?
I would like to find the distinct Code values and get a return like this: I can’t figure out how to write a SQL query that would return me the above results. Anyone have any experience with a query like this or similar? Answer In proper RDBMS: In MySQL… the UNION removes duplicates
left join returning more than expected
Using the following query table1 returns 16 rows and table2 returns 35 rows. I was expecting the above query to return 16 rows because of the left join, but it is returning 35 rows. right join also returns 35 rows Why is this happening and how do I get it to return 16 rows? Answer LEFT JOIN can return multiple
How can I return pivot table output in MySQL?
If I have a MySQL table looking something like this: company_name action pagecount ——————————- Company A PRINT 3 Company A PRINT 2 Company A PRINT 3 Company B EMAIL Company B PRINT 2 Company B PRINT 2 Company B PRINT 1 Company A PRINT 3 Is it possible to run a MySQL query to get output like this: company_name EMAIL
How do I make the rows of a lookup table into the columns of a query?
I have three tables: students, interests, and interest_lookup. Students has the cols student_id and name. Interests has the cols interest_id and interest_name. Interest_lookup has the cols student_id and interest_id. To find out what interests a student has I do What I want to do is get a result set like where the column name ‘interest_a’ is a value in interests.name