Skip to content

Tag: oracle

Display the type of triangle

This is the problem: https://www.hackerrank.com/challenges/what-type-of-triangle/problem I’ve tried this solution: The above solution does not work. Whereas the solution given below works I feel both solutions are the same except swapping the side of the operands while I also appropriately changed the o…

limit column char trigger plsql

I’m starting to learn PLSQL and created a very very simple table, I’m trying to get familiar with functions and triggers. My table: Now to the question, I want to limit before insert or update new row (biuefer) so that the first name must be 8 characters, not less, not more. If you try to insert a…

ALTER TABLE ADD field getting ORA-00942 error

I run the following command: and I get the following error message: SQL Error: ORA-00942: table or view does not exist 00942. 00000 – “table or view does not exist” *Cause: *Action: When I select * from users, I get records. Can someone tell me what I am doing wrong here? Answer This was a p…

How to use listagg properly with case statements

I am trying to use listagg but I’m getting the wrong output. Normally, I would use each case statement separately, but then how would I use listagg? Table A: Table B: Desired Output: My attempted (wrong) code: Answer Here’s one option, which uses multiple self-joins. lines #1 – 14 represent …

Group rows into range while also showing gap

I am in need of a database select query solution for transforming a series of breakdown details into a summarized version of it, possibly in a view. Consider the table below. It has a composite primary key of (PK_1, PK_2, PK_3, and SEQUENCE_NO). Only including all records with the STATUS_CODE of “Y&#822…

Display output is columns based on filter criteria

I am trying to display data is columns/subcolumns based on certain filter criteria using case when statement but not getting required output. data: based on my current case statement, here is how my output looks: I want to display the following format, bonus if I can get the subtotal/totals: I also need Subto…