103: LOOP
104: FETCH c1 INTO X_segment_name, X_table_name, X_constant;
105: EXIT WHEN c1%NOTFOUND;
106:
107: X_select1 := DBMS_SQL.OPEN_CURSOR;
108:
109: /* Se o segmento nao e' uma X_constant entao
110: Verifica se o segmento esta' na tab. RA_CUST_TRX_TYPES entao
111: se o tipo de conta for Revenue Account entao
139: /* Mount the select dynamically to find the segment (X) in
140: gl_code_combinations table */
141:
142: /*Bug 2939830 - SQL Bind compliance project
143: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
144: FROM gl_code_combinations WHERE code_combination_id = '
145: || X_gl_id, DBMS_SQL.v7);
146: */
147:
141:
142: /*Bug 2939830 - SQL Bind compliance project
143: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
144: FROM gl_code_combinations WHERE code_combination_id = '
145: || X_gl_id, DBMS_SQL.v7);
146: */
147:
148: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
149: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
144: FROM gl_code_combinations WHERE code_combination_id = '
145: || X_gl_id, DBMS_SQL.v7);
146: */
147:
148: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
149: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
150:
151: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
152: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
145: || X_gl_id, DBMS_SQL.v7);
146: */
147:
148: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
149: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
150:
151: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
152: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
153: -- End of fix for SQL Bind Compliance
147:
148: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
149: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
150:
151: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
152: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
153: -- End of fix for SQL Bind Compliance
154:
155: /* Mount the where clause to get the gl_code_combinations id */
148: DBMS_SQL.PARSE(X_select1, 'SELECT '||X_segment_name||'
149: FROM gl_code_combinations WHERE code_combination_id = :x and chart_of_accounts_id = :y ', DBMS_SQL.v7);
150:
151: DBMS_SQL.BIND_VARIABLE (X_select1, ':x', X_gl_id) ;
152: DBMS_SQL.BIND_VARIABLE (X_select1, ':y', X_struct_num) ;
153: -- End of fix for SQL Bind Compliance
154:
155: /* Mount the where clause to get the gl_code_combinations id */
156:
153: -- End of fix for SQL Bind Compliance
154:
155: /* Mount the where clause to get the gl_code_combinations id */
156:
157: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
158: X_selection := DBMS_SQL.EXECUTE(X_select1);
159: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
160: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
161: IF X_first_time THEN
154:
155: /* Mount the where clause to get the gl_code_combinations id */
156:
157: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
158: X_selection := DBMS_SQL.EXECUTE(X_select1);
159: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
160: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
161: IF X_first_time THEN
162: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
155: /* Mount the where clause to get the gl_code_combinations id */
156:
157: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
158: X_selection := DBMS_SQL.EXECUTE(X_select1);
159: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
160: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
161: IF X_first_time THEN
162: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
163: X_segs(x_increment) := x_segment_amount;
156:
157: DBMS_SQL.DEFINE_COLUMN(X_select1,1,X_segment_amount,25);
158: X_selection := DBMS_SQL.EXECUTE(X_select1);
159: IF DBMS_SQL.FETCH_ROWS (X_select1) > 0 THEN
160: DBMS_SQL.COLUMN_VALUE(X_select1,1,X_segment_amount);
161: IF X_first_time THEN
162: X_condition := X_segment_name||'='||''''||X_segment_amount||'''';
163: X_segs(x_increment) := x_segment_amount;
164: X_first_time := FALSE;
176: X_condition := X_condition||' and '||X_segment_name||'='||''''||X_constant||'''';
177: X_segs(x_increment) := x_constant;
178: END IF;
179: END IF;
180: DBMS_SQL.CLOSE_CURSOR(X_select1);
181: END LOOP;
182:
183: X_condition := X_condition||' and chart_of_accounts_id ='||to_char(x_struct_num);
184:
183: X_condition := X_condition||' and chart_of_accounts_id ='||to_char(x_struct_num);
184:
185: /* Mount the select to get the account on gl_code_combinations */
186: -- Bug 2089230 following close cursor was moved above - before end loop.
187: --DBMS_SQL.CLOSE_CURSOR(X_select1);
188: BEGIN
189: X_select2 := DBMS_SQL.OPEN_CURSOR;
190:
191: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
185: /* Mount the select to get the account on gl_code_combinations */
186: -- Bug 2089230 following close cursor was moved above - before end loop.
187: --DBMS_SQL.CLOSE_CURSOR(X_select1);
188: BEGIN
189: X_select2 := DBMS_SQL.OPEN_CURSOR;
190:
191: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
192: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
193:
188: BEGIN
189: X_select2 := DBMS_SQL.OPEN_CURSOR;
190:
191: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
192: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
193:
194: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
190:
191: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
192: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
193:
194: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
197: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
198: END IF;
191: /*ignored conversion for bug 2939830 since entire where clause cannot be passed as bind variable - GBUZSAK*/
192: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
193:
194: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
197: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
198: END IF;
199: DBMS_SQL.CLOSE_CURSOR(X_select2);
192: DBMS_SQL.PARSE(X_select2,'SELECT code_combination_id FROM gl_code_combinations WHERE '||X_condition,DBMS_SQL.v7);
193:
194: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
197: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
198: END IF;
199: DBMS_SQL.CLOSE_CURSOR(X_select2);
200: EXCEPTION
193:
194: DBMS_SQL.DEFINE_COLUMN(X_select2,1,X_amount_id);
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
197: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
198: END IF;
199: DBMS_SQL.CLOSE_CURSOR(X_select2);
200: EXCEPTION
201: WHEN OTHERS THEN NULL;
195: X_selection := DBMS_SQL.EXECUTE(X_select2);
196: IF DBMS_SQL.FETCH_ROWS (X_select2) > 0 THEN
197: DBMS_SQL.COLUMN_VALUE(X_select2,1,X_amount_id);
198: END IF;
199: DBMS_SQL.CLOSE_CURSOR(X_select2);
200: EXCEPTION
201: WHEN OTHERS THEN NULL;
202: END;
203: