Skip to content
Advertisement

Tag: oracle

How to generate multiple combinations from tables using SQL?

I have few combinations of records in my table but i want to generate Multiple combinations from original table. Records in table codeset codevalue column system test1 1 null sys1 test2 2 col2 sys1 test3 3 col3 sys1 test3 4 col4 sys1 test3 5 col5 sys1 test4 null col6 sys1 test5 6 col7 sys2 test5 7 col8 sys2 After applied

Unable to Convert to Date

I am trying to return just the date from a datetime field When I run the Select Claus with just the first line, it work as expected. But when I add the second line, I receive From keyword not found error. ORA-00923: FROM keyword not found where expected Answer In Oracle, DATE is a reserved word and you cannot use

Oracle INSERT with a CASE statement

I have the following table declaration and I’m trying to use a case statement to INSERT some rows and I’m getting the following error ORA-00976: Specified pseudocolumn or operator not allowed here. Can someone please let me know how to rectify the INSERT code. Thanks in advance to all who answer. Answer level pseudocolumn goes with select (not just values).

When I update the same row in a table in SQL more than once, it gives an ORA-00001: unique constraint error

I am trying to update a row in a table in SQL back to back and am getting an error when running the second update statement. I’m getting an error in the second update statement. ORA-00001: unique constraint (ADMIN.JHIST_EMP_ID_ST_DATE_PK) violated ORA-06512: at “ADMIN.ADD_JOB_HISTORY”, line 10 ORA-06512: at “ADMIN.UPDATE_JOB_HISTORY”, line 2 ORA-04088: error during execution of trigger ‘ADMIN.UPDATE_JOB_HISTORY’ I was expecting

How can I limit the max value of an SQL field?

I am trying to force the value of the field PRICE to be under 500 if is it paid with cash (PAYMENT = “CASH”), to make impossible to insert anything over that. The table (SALES) is something like this: ID (PK) [INT] | DATE [VARCHAR] | SHOP [VARCHAR] | PRICE [FLOAT] | PAYMENT [VARCHAR] I am almost new with SQL

Oracle Hierarchical Query at depth level

I have a requirement to build a table from a hierarchical table. Table structure as below: emp_hier table: emp_id supervisorId 100 null 1 100 2 1 3 2 New table: I have to write a select query on the emp_heir table and the selected data should look like this: sel_emp_id rel_emp_id relation depth_lvl 100 100 self 0 100 1 My

Advertisement