I have a table that has process engines 1,2,3,4,5,6 with a running status. When one of the engines is down the record gets deleted from the table. Using a case statement I can display the first engine that is down but how do I go about displaying the engines if 2 or more engines are down. For e.g. how do
Tag: oracle
How to enable logging for SQL statements when using JDBC
I am trying to enable logs using my JDBC program by connecting to Oracle database in eclipse IDE. I have gone through this SO post JDBC logging to file then I have created below java program and running it from my eclipse IDE, but I was not able to see any logs generated by the JDBC driver classes. and I
How to Select Top 100 rows in Oracle?
My requirement is to get each client’s latest order, and then get top 100 records. I wrote one query as below to get latest orders for each client. Internal query works fine. But I don’t know how to get first 100 based on the results. Any ideas? Thanks. Answer Assuming that create_time contains th…
Select distinct returns duplicates
I have the following query: But it returns duplicates in TK.TICKETID attribute. And if i remove other attributes all ok. e.g. How can I return only a single record per TK.TICKETID? Answer Try this:
Set server output only in spool
Is it possible to set the server output only into the spool file and not in the shell ? Inside MY_PROCEDURE I have this : I would like to put Hello World only in log.txt, not in the screen shell. Answer Simplest way is to pipe the unix output to /dev/null
Getting distinct values with the highest value in a specific column
How can I get the highlighted rows from the table below in SQL? (Distinct rows based on User name with the highest Version are highlighted) In case you need plain text table: What I have so far is (works for one user) Answer this might help you : sql fiddle
Oracle Apex column link from LOV values
Can you please advise if below is even possible. Using Oracle 11g and APEX 4.2.6. I have a data grid that brings all tasks from a master table. But show the task name via a LOV. I am trying to add …
Oracle Error PLS-00323: subprogram or cursor is declared in a package specification and must be defined in the package body
Can someone help me put my pl/sql procedure in a package? I’ve tried and I’m struggling with it: This is what I have, for my package specification: This is my package body where im running into the problems: if anyone could help me fix the errors i’d appreciate it: Answer Your header and bod…
How to give comments in SQL
I am working in SQL. What is the complete explanation for using comments in SQL, with some example code? Answer MySQL Server supports three comment styles: From a # character to the end of the line. From a — sequence to the end of the line. In MySQL, the “– ” (double-dash) comment style requires t…
How does UNION ALL return blanks in one column and data in another?
I’ve a View that has two SELECT statements returning data using UNION ALL. SELECT column1, column2, column3, column4 FROM table1 UNION ALL SELECT column1, column2, column3, column4 FROM table2 So, …