It's UWAweek 42 (2nd semester, week 12)

help1402

This forum is provided to promote discussion amongst students enrolled in CITS1402 Relational Database Management Systems.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 9 articles in this topic
Showing 9 of 612 articles.
Currently 7 other people reading this forum.


 UWA week 40 (2nd semester, week 10) ↓
SVG not supported

Login to reply

👍?
helpful
4:28pm Fri 4th Oct, Henry Y.

Hi, How do we create error codes in SQL? Thanks,


SVG not supported

Login to reply

👍x1
helpful
9:13am Sat 5th Oct, Eusha K.

I have the same question! After looking up online, it should be something like: CREATE TRIGGER abort_delete_from_my_tbl BEFORE DELETE ON my_tbl BEGIN SELECT RAISE(ABORT, 'You can''t delete records from my_tbl'); END; However, my output runs perfectly, but the way the error is presented in the Expected section of the test cases don't match my output. Expected section shows: Trigger failed as expected due to related po_items: Error: Cannot delete pos record with associated po_items. My section shows: Unexpected sqlite3 error: Error: near line 12: Cannot delete pos record with associated po_items Don't know how to fix that though!


SVG not supported

Login to reply

👍?
helpful
9:50am Sat 5th Oct, Eusha K.

Got it, use SELECT RAISE(FAIL, 'msg');


SVG not supported

Login to reply

👍?
helpful
4:56pm Sat 5th Oct, ANONYMOUS

I also got the 'Unexpected sqlite3 error: Error: near line 13: Cannot delete pos record with associated po_items' error I used both abort & fail but the results remained the same (also as the hint provided by the question we're supposed to use abort to solve this one),I have no idea where should i debug and find where the issues are. I didn't find relevant materials for the raise() that could help me solve this problem, and it raises my concern that if this kind of situation would happen in the exam, as the materials provided from lms do not provide enough support for students to solve the problems


SVG not supported

Login to reply

👍?
helpful
5:11pm Sat 5th Oct, Henry Y.

Legend, absolute lifesaver


SVG not supported

Login to reply

👍?
helpful
5:43pm Sat 5th Oct, Jichunyang L.

The reason you're not getting the correct answer is due to your format, not your SQL grammar. You need to ensure the error is in Line 12; otherwise, you won't get the expected result. A simple way to address this is by ensuring there are no blank lines in your command.


SVG not supported

Login to reply

👍x4
helpful
1:10pm Sun 6th Oct, Andre H.

Actually this is a little bit silly but you have to put period (.) on the message 'Cannot delete pos record with associated po_items.' It should be something like this. Found it after meddling around.


 UWA week 41 (2nd semester, week 11) ↓
SVG not supported

Login to reply

👍?
helpful
10:45am Mon 7th Oct, Angelica VB.

Thanks a lot!! I was having problems with the formatting too and this solution totally fixed it!


SVG not supported

Login to reply

👍?
helpful
7:30pm Tue 8th Oct, ANONYMOUS

thank you so much, this saved my life

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy