In my project, front end needs, following JSON data with this format. So I Created two table for user and their addresses, So I plan to going with this table structure, USER_TABLE USER_ADDRESS Address table I created this way because, each user have two addresses, one is permanent and other one is corresponde…
Tag: oracle
“Column not allowed here” error in INSERT statement-ORA-00984
I have the same error as this one : “column not allowed here” error in INSERT statement . My SQL table’s structure looks like this: Have I done something wrong? Edit: even with that way it doesn’t work Answer Update your insert statement as –
Checking the Oracle SQL DECODE function result against 0
I’m looking at some old PL/SQL code and I have dozen of DECODE functions written like this: DECODE(value_1, value_2, 1, 0) = 0 Now, I know these DECODEs make comparison between value_1 and value_2 and they return true or false based on the outcome of comparison. But, for the love of coding, could someon…
Change the text color of a shuttle based on a condition in oracle apex
I have two different tables in oracle apex, the first one is the documentation table which contains KPI’s, the second one is the results table which contains all the KPI’s results. I have created a shuttle in a page to choose KPI’s from documentation table then, insert the results into the r…
How compare dates that are equal when one has time as well
I’m trying to compare dates and it looks like I’m doing it like examples online, but I only see the rows of dates returned when I do >= for the comparison. When I just use = it doesn’t return anything. This is my query with >= for the date comparison: I see a lot of this sort of thing …
SQL – Consolidate and group records from multiple rows to columns
Is there a way to transpose multiple rows and group them to columns? I have a table that has data from Invoice values from different tables and columns. Now, I want to have them by Invoice numbers. InvoiceNumber Table Column Value 123 A Column A1 ABC 123 A Column A2 DEF 123 A Column A3 GHI 123 B Column B1
Oracle procedure saving SYSDATE
As part of a larger procedure I’m trying to write some code, which saves SYSDATE into a variable but I’m running into a problem. I narrowed it down to the following. Can someone please help me out. Answer In PLSQL you can just assign: if you insist on sql all you have to do is to add into after se…
How can i store results of a query in an array?
I have to store last 5 employees_id’s from employees table into an array. I made the query correct and i have the array, but i can’t understand the syntax to store the results in that array. Here’s my code and here’s my query How can i store the results from the query in the array? As …
Can “value in list or list is empty” be written shorter?
Given this SQL: Is there a way to write the “in list or list is empty” part shorter? Preferably in a way that contains the list only once (see the Don’t_repeat_yourself principle ) I’m interested for Oracle SQL or PL/SQL, but other information is also welcome. As requested, a MRE that …
Hourly average for timestamps columns – FROM keyword not found where expected
I would like to get the hourly average of two columns. The type of the columns is timestamp. I try this: I do not know if this is the right way to go at all. But the query is not correct. I get this error: 00923. 00000 – “FROM keyword not found where expected” In the end I would like