I need to retrieve a field from a table and display the results rounded up to the next whole number if is not whole yet. For example: I have in my table the field working hours. I need to create de following logic. Else select as it is (4.0). Answer Is this what you want?
Tag: oracle
Combine 2 similar update queries into one query
Is there a way by which I can combine the above two queries (updating the same table) into one single query? Answer You may use a case expression to achieve this eg.
How to turn 5 sets of data from one column into 5 different columns
My current table looks like this CPNT_ID Org_Id Stud ID Compl_Dte Trainee Org001 101010 Nov 13, 2016 SvcTech Org001 101010 Nov 13, 2016 CrewChief Org001 101010 Nov 13, 2016 Trainee Org001 101013 Nov 13, 2016 SvcTech Org001 101013 Nov 13, 2016 Trainee Org002 101011 Nov 13, 2016 SvcTech Org002 101011 Nov 13, 20…
Adding elements in the end to a json array of objects in Oracle
I have a json column named “configuration” in an Oracle database with a data like- How can add elements to the “sections” array inside the CLOB? for example, add this object to the CLOB- {“active”:false, “code”:”page.body”} I tried to do this- but I …
converting rows to columns using oracle sql
I’m trying to convert rows into columns using the following sample: LVL COL_VALUE TABLE_SRC 16 INT: ADDRESS_LINE_2:NULL INT 16 BASE: ADDRESS_LINE_2:X BASE 17 INT: ADDRESS_LINE_3:NULL INT 17 BASE: ADDRESS_LINE_3:X BASE The output should be: INT BASE INT: ADDRESS_LINE_2:NULL BASE: ADDRESS_LINE_2:X INT: AD…
Join tables together
I need to write a SQL statement to find the ‘Action’ (category) films with the shortest running time (length). Your query should output the titles and lengths of the films. This is the database schema I have. I created 3 tables and inserted some records on these tables. I write my query like this: But there a…
Oracle SQL Select: getting duplicate results joining tables
I’m starting with SQL and doing some exercises and I’m completely stuck on the last one. It is about looking for streets in the same country name. Two tables are used, locations and countries from the HR schema. The problem is that I don’t know how to avoid duplicate results. For example if …
SQL duplicates despite grouping on all key variables?
I am new to SQL and use it for work, so I am going to censor the real names of columns going forward in the query below. I am writing a query where the necessary data is spread across 3 tables. I have a network with users who send and receive packages from different nodes, and I want to see
Procedure: PL/SQL: ORA-00904: “QUARTER”: invalid identifier
I’m new to Oracle PL/SQL and I’m attempting to create a procedure, called pop_date_dim, which populates an already-existing date dimension called date_dim. It does so by accepting both a date (DDMMYYYY) and a number (n) as parameters. The date dimension is then populated by using a FOR loop. Unfor…
How do you make your check constraint case insensitive in SQL?
This is my piece of code. I want to be able to insert values in lower case too. Example down Below: But I can edit my check constraints to add ‘Web Site’ or ‘Catalog’, I just want to try something else. Thanks. Answer You may lowercase the column and then compare to lowercase string li…