118: LOOP
119: FETCH c1 INTO X_segment_name, X_table_name, X_constant;
120: EXIT WHEN c1%NOTFOUND;
121:
122: X_select1 := DBMS_SQL.OPEN_CURSOR;
123:
124: /* Se o segmento nao e' uma X_constant entao
125: Verifica se o segmento esta' na tab. RA_CUST_TRX_TYPES entao
126: se o tipo de conta for Revenue Account entao
166: /* Mount the select dynamically to find the segment (X) in
167: gl_code_combinations table */
168:
169: /*Bug 2939830 - SQL Bind compliance project
170: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
171: FROM gl_code_combinations WHERE code_combination_id = '
172: || X_gl_id, DBMS_SQL.v7);
173: */
174:
168:
169: /*Bug 2939830 - SQL Bind compliance project
170: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
171: FROM gl_code_combinations WHERE code_combination_id = '
172: || X_gl_id, DBMS_SQL.v7);
173: */
174:
175: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
176: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
171: FROM gl_code_combinations WHERE code_combination_id = '
172: || X_gl_id, DBMS_SQL.v7);
173: */
174:
175: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
176: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
177:
178: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
179: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
172: || X_gl_id, DBMS_SQL.v7);
173: */
174:
175: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
176: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
177:
178: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
179: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
180: -- End of fix for SQL Bind Compliance
174:
175: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
176: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
177:
178: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
179: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
180: -- End of fix for SQL Bind Compliance
181:
182: /* Mount the where clause to get the gl_code_combinations id */
175: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
176: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
177:
178: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
179: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
180: -- End of fix for SQL Bind Compliance
181:
182: /* Mount the where clause to get the gl_code_combinations id */
183:
180: -- End of fix for SQL Bind Compliance
181:
182: /* Mount the where clause to get the gl_code_combinations id */
183:
184: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
185: X_selection := DBMS_SQL.EXECUTE(X_select1);
186: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
187: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
188: IF X_first_time THEN
181:
182: /* Mount the where clause to get the gl_code_combinations id */
183:
184: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
185: X_selection := DBMS_SQL.EXECUTE(X_select1);
186: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
187: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
188: IF X_first_time THEN
189: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
182: /* Mount the where clause to get the gl_code_combinations id */
183:
184: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
185: X_selection := DBMS_SQL.EXECUTE(X_select1);
186: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
187: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
188: IF X_first_time THEN
189: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
190: X_segs(x_increment) := x_segment_amount;
183:
184: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
185: X_selection := DBMS_SQL.EXECUTE(X_select1);
186: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
187: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
188: IF X_first_time THEN
189: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
190: X_segs(x_increment) := x_segment_amount;
191: X_first_time := FALSE;
203: X_condition := X_condition||' and '||X_segment_name||'='||''''||X_constant||'''';
204: X_segs(x_increment) := x_constant;
205: END IF;
206: END IF;
207: DBMS_SQL.CLOSE_CURSOR(X_select1);
208: END LOOP;
209:
210: X_condition := X_condition||' and chart_of_accounts_id ='||to_char(x_struct_num);
211:
210: X_condition := X_condition||' and chart_of_accounts_id ='||to_char(x_struct_num);
211:
212: /* Mount the select to get the account on gl_code_combinations */
213: -- Bug 2089230 following close cursor was moved above - before end loop.
214: --DBMS_SQL.CLOSE_CURSOR(X_select1);
215: BEGIN
216: X_select2 := DBMS_SQL.OPEN_CURSOR;
217:
218: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
212: /* Mount the select to get the account on gl_code_combinations */
213: -- Bug 2089230 following close cursor was moved above - before end loop.
214: --DBMS_SQL.CLOSE_CURSOR(X_select1);
215: BEGIN
216: X_select2 := DBMS_SQL.OPEN_CURSOR;
217:
218: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
219: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
220:
215: BEGIN
216: X_select2 := DBMS_SQL.OPEN_CURSOR;
217:
218: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
219: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
220:
221: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
217:
218: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
219: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
220:
221: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
224: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
225: END IF;
218: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
219: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
220:
221: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
224: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
225: END IF;
226: DBMS_SQL.CLOSE_CURSOR(X_select2);
219: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
220:
221: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
224: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
225: END IF;
226: DBMS_SQL.CLOSE_CURSOR(X_select2);
227: EXCEPTION
220:
221: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
224: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
225: END IF;
226: DBMS_SQL.CLOSE_CURSOR(X_select2);
227: EXCEPTION
228: WHEN OTHERS THEN NULL;
222: X_selection := DBMS_SQL.EXECUTE(X_select2);
223: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
224: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
225: END IF;
226: DBMS_SQL.CLOSE_CURSOR(X_select2);
227: EXCEPTION
228: WHEN OTHERS THEN NULL;
229: END;
230: