Trigger Oracle with sysdate

0

I have a trigger in a simple database, what I want that trigger to do is generate an id with characters and numbers, but it does not work.

I hope you can help me, I thank you very much.

    
asked by Jhorman Ruswel 26.09.2017 в 03:11
source

3 answers

0

As I see in your code, the ID you want to create requires: SYSDATE, USERNAME and PASSWORD. Why do you consult the database to obtain those values? You can get them in the trigger using NEW: [column] and with that build your id. If you notice, the error that appears is a "no data found". It makes sense because you are consulting with the select records of a table that I assume is empty. Even if I had records it would be wrong because if there are several records you can not use the "select .. into".

    
answered by 27.09.2017 / 17:56
source
0

I make an insert to the USER table

And I missed the following error

    
answered by 26.09.2017 в 18:45
0

Indeed Mauricio, I realized that I needed to use: NEW in USERNAME and PASSWORD, also thanks to your answer, I used the SELECT in DUAL and I managed to insert.

Thank you very much for your response.

    
answered by 30.09.2017 в 20:02