30: -- (2) copy question from a existing question, so insert data
31: -- (3) update question, so update data
32: -- (4) delete question, so delete data
33: IF (x_mode = 1) THEN
34: -- First insert into msc_questions_b and then into msc_questions_tl
35: -- Note that the sequence will ensure that all question_ids are
36: -- greater than 5001
37: SELECT msc_questions_s.nextval
38: INTO x_question_id
66: from msc_questions_b
67: where question_code = x_question_code);
68: msc_util.msc_debug('Inserted into msc_questions_b:'|| sql%rowcount);
69:
70: INSERT INTO MSC_QUESTIONS_TL(
71: QUESTION_ID
72: ,LANGUAGE
73: ,USER_QUESTION_NAME
74: ,DESCRIPTION
93: ,fnd_global.conc_login_id
94: FROM dual
95: WHERE not exists
96: (select 'already exists'
97: from msc_questions_tl
98: where question_id = (select question_id
99: from msc_questions_b
100: where question_code = x_question_code)
101: and language = x_lang_code);
99: from msc_questions_b
100: where question_code = x_question_code)
101: and language = x_lang_code);
102:
103: msc_util.msc_debug('Inserted msc_questions_tl:' || to_char(sql%rowcount));
104: ELSIF (x_mode = 2) THEN -- copy mode
105: SELECT msc_questions_s.nextval
106: INTO x_question_id
107: FROM dual;
135: from msc_questions_b
136: where question_code = x_question_code);
137: msc_util.msc_debug('Inserted into msc_questions_b:'|| sql%rowcount);
138:
139: INSERT INTO MSC_QUESTIONS_TL(
140: QUESTION_ID
141: ,LANGUAGE
142: ,USER_QUESTION_NAME
143: ,DESCRIPTION
159: ,fnd_global.user_id
160: ,sysdate
161: ,fnd_global.user_id
162: ,fnd_global.conc_login_id
163: FROM msc_questions_tl q
164: WHERE q.language = x_lang_code
165: AND q.question_id = (select question_id
166: from msc_questions_b
167: x where question_code = x_copy_question)
166: from msc_questions_b
167: x where question_code = x_copy_question)
168: AND not exists
169: (select 'already exists'
170: from msc_questions_tl
171: where question_id = (select question_id
172: from msc_questions_b
173: where question_code = x_question_code)
174: and language = x_lang_code);
172: from msc_questions_b
173: where question_code = x_question_code)
174: and language = x_lang_code);
175:
176: msc_util.msc_debug('Inserted msc_questions_tl:' || to_char(sql%rowcount));
177: ELSIF (x_mode = 3) THEN -- update mode
178: update msc_questions_b
179: set package_name = x_package_name
180: where question_code = x_question_code;
181: msc_util.msc_debug('Updated msc_questions_b:' || to_char(sql%rowcount) ||
182: ':'|| x_question_code ||'with package name value:' ||
183: x_package_name);
184:
185: update msc_questions_tl
186: set user_question_name = x_question
187: where question_id = (select question_id
188: from msc_questions_b
189: where question_code = x_question_code)
187: where question_id = (select question_id
188: from msc_questions_b
189: where question_code = x_question_code)
190: and language = x_lang_code;
191: msc_util.msc_debug('Updated msc_questions_tl:' || to_char(sql%rowcount) ||
192: ':' || x_question_code || 'with user question:' ||
193: x_question);
194: ELSIF (x_mode = 4) THEN -- delete mode
195: delete msc_questions_tl
191: msc_util.msc_debug('Updated msc_questions_tl:' || to_char(sql%rowcount) ||
192: ':' || x_question_code || 'with user question:' ||
193: x_question);
194: ELSIF (x_mode = 4) THEN -- delete mode
195: delete msc_questions_tl
196: where question_id = (select question_id
197: from msc_questions_b
198: where question_code = x_question_code);
199: msc_util.msc_debug('Deleted msc_questions_tl:'|| to_char(sql%rowcount) ||
195: delete msc_questions_tl
196: where question_id = (select question_id
197: from msc_questions_b
198: where question_code = x_question_code);
199: msc_util.msc_debug('Deleted msc_questions_tl:'|| to_char(sql%rowcount) ||
200: ':' || x_question_code);
201:
202: delete msc_questions_b
203: where question_code = x_question_code;