[Solved] Sql If statement error

I think you need: CREATE OR REPLACE TRIGGER CREAT_SERVIÇO BEFORE INSERT ON SERVIÇO FOR EACH ROW BEGIN if(:new.MORADA_RUA is NULL and :NEW.LOCAIS_ID_LOCAL is NULL) THEN RAISE_APPLICATION_ERROR(-20000, ‘YOU HAVE TO HAVE AN ADRESS OR AN LOCAL’); END IF; END; If your trigger is going do disallow inserting when both address and local are null. But to … Read more

[Solved] PL/SQL Implementation of Hungarian/Kuhn-Munkres Algorithm [closed]

I couldn’t find one…so I made one. Now I want to share it with anyone else who needs it. It has been tested and validated, and any additional comments are welcome. https://github.com/manas1213/hungarian_algorithm This is based on the comprehensive algorithm outlined at http://csclab.murraystate.edu/bob.pilgrim/445/munkres.html. solved PL/SQL Implementation of Hungarian/Kuhn-Munkres Algorithm [closed]

[Solved] How to traverse the same table with nested cursors in oracle [closed]

Try something like this: begin for c in (select * from child_table) loop insert into table1 select * from parent_table where column_1 = c.column_10; insert into table2 select * from parent_table where column_1 = c.column_10; insert into table3 (column_1, column_2, column_3, column_4, column_5, column_6, column_7, column_8, column_9, column_10) values (c.column_1, c.column_2, c.column_3, c.column_4, c.column_5, c.column_6, … Read more

[Solved] PLSQL procedure to add numbers by fetching records from table [closed]

Something like this? set serveroutput on declare l_what varchar2(10); –> fail or pass begin for cur_r in (select col1, col2, col3, –> to be compared with col1 + col2 result from your_table) loop l_what := case when cur_r.col1 + cur_r.col2 = cur_r.col3 then ‘pass’ else ‘fail’ end; dbms_output.put_line(cur_r.col1 ||’ + ‘|| cur_r.col2 ||’ = ‘ … Read more

[Solved] Receive an unexpected symbol error in my PLSQL query [closed]

You appear to have an extra quote in your query. The following should work for you: vSQl := ‘select toValueText(a.code, a.descr) from (select currency_code code, des1 descr ‘||’from sy_curr_code ) a ‘; Note the quote before your closing parenthesis has been removed. 1 solved Receive an unexpected symbol error in my PLSQL query [closed]

[Solved] How to write and call an Oracle function in SQL

Generally it is considered bad practice to call a function in SQL which executes SQL. It creates all kinds of problems. Here is one solution: create or replace function my_fun ( p_sum in number) return varchar2 is begin if p_sum > 100 then return ‘ALERT’; else return ‘OK’; end if; end; / Run it like … Read more

[Solved] object creation generates error in oracle

The afiseaza_animal procedure belongs to the type and you need to define it in the body of the type (using CREATE TYPE BODY) and not as a standalone procedure (using CREATE PROCEDURE). DROP TYPE specii_inr; CREATE TYPE specii_inr UNDER gestiune_zoo ( specii_inrudite VARCHAR2(20), OVERRIDING member procedure afiseaza_animal ); / CREATE OR REPLACE TYPE BODY specii_inr … Read more

[Solved] data not showing with sno

The following should get what you’re asking for: INSERT INTO SOME_TABLE (SNO, USERID) VALUES ((SELECT NVL(MAX(SNO)+1, 1) FROM SOME_TABLE WHERE USERID = &userid), &userid); where &userid is your USERID value. SQLFiddle here 1 solved data not showing with sno

[Solved] Can somebody explain dbms_sql.number_table [closed]

Better to understand DBMS_SQL itself to some extent, before understanding NUMBER_TABLE. ( I do this for My Learning!) NUMBER_TABLE is Actually, TYPE number_table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; So, only numbers are allowed! FlowChart on How DBMS_SQL Works! : Your interested area comes in bind variable box — | open_cursor | — ———– … Read more