My query is Select class_time from tableA which produces: 0200AM 0230AM 0300AM 0330AM 0400AM i want above result as 0200AM 0230AM 0300AM 0330AM 0400AM 0430AM
Tag: oracle
SQL Query/ Assigning Rank
I am interested in SQL query not the PLSQL code. We need to assign the rank based on date and id value Input table should look like below output table should look like below Answer This is a type of gaps-and-islands problem. In this case, the simplest solution is probably the difference of row numbers: Why th…
process/transaction data partitioning
i have problem with partitioning the process data i have from our workflow system. data are stored in database step after step (one step is one row) for couple of processes (id) and a date of the event. in simplified data is looks as follows: what i need to have is such short table the “x” step is…
getting output of union all without using union all
I have been given a situation to find the common record between 2 tables without using union. I could do it. But I am not able to do ‘union all’. I mean I have to find out output of 2 table including …
Is it possible to remove milliseconds from TO_TIMESTAMP function
I have this query which gives me this output its fine except for .000000000 part. I dont need that part, and im not sure how its coming up if its HH:MI:SS format this is for oracle sql developer. Answer Why not just convert to a date? That datatype doesn’t have fractions of a second:
How to use Replace/Substitution function in PL SQL
I’ve a doubt regarding replacing / substituting values in PLSQL. I’ve used listagg to segregate n number of values with each and every value being splitted by comma delimiter. For instance when executing the above query it returns 7digit alpha numeric values. For example ABCD123,EFGH456,IJKL789 Af…
Regexp_replace to replace specific value
I have data in a column at different position which i want to replace using regexp_replace(). Column value : Business solution, management services, credit Management services, business solution, credit I want to replace business solution with business solutions in a column nothing else I want to change.. Ple…
SQL (Persons share the same birthday but they are exactly 100 years older or younger)
i have this table: How do I fetch a list of Persons who have the same dob and exactly 100 years older or younger? Expected rows: The difference between dob should be 100 years Answer If the DOB is a date data type, would suggest using TRUNC and ADD_MONTHS.
Oracle – Selecting record based on latest date
In this query, in the ODF_CA_NL_INIT_REQ_NOTE n table, there can be multiple NL_NOTEs per each record in the ODF_CA_OTHER o table. One to many relationship. I want to select the n.NL_NOTE for each …
Is there an SQL function that let us put condition above WHERE clause?
I have some query with several WHERE clauses. Based on an external variable :flag, I would like to set a condition when I can use a WHERE clause. Below is a presentation of what I mean. There is a …