Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2006, 05:56 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forms Procedure do what?

Hi,
I am newcomer in Oracle Forms Programming.
Please let me know step by step what does this code do in this procedure?
I will appreciate this very much.

Saboorpan


Below this is a procedure :

PROCEDURE get_file (p_type in VARCHAR2) IS
fp UTL_FILE.FILE_TYPE;
p_loc VARCHAR2(100) := :Loc.file_loc;
p_file_start VARCHAR2(20) := :Loc.file_start;
p_file_end VARCHAR2(20) := :loc.file_end;
p_start_plsql VARCHAR2(5000);
p_mid_plsql VARCHAR2(2000);
p_end_plsql VARCHAR2(5000);
p_out_status NUMBER(4) := 0;
v_line VARCHAR2(1000);
v_l_start NUMBER(10);
v_l_end NUMBER(10);
v_ol_start NUMBER(10);
v_ol_end NUMBER(10);
v_temp NUMBER;
v_temp_line VARCHAR2(300);
v_temp_date DATE;
v_quick_list VARCHAR2(1000);



BEGIN

p_start_plsql := 'DECLARE fp UTL_FILE.FILE_TYPE; ';
p_start_plsql := p_start_plsql||' i number; ';
p_start_plsql := p_start_plsql||'BEGIN ';

p_end_plsql := ' BEGIN ';
p_end_plsql := p_end_plsql||' fp := UTL_FILE.FOPEN('''||p_loc||''','''||
p_file_start||'''||to_char(i)||'''||p_file_end||'' ',''r''); ';
p_end_plsql := p_end_plsql||' UTL_FILE.FCLOSE (fp); ';
p_end_plsql := p_end_plsql||' DBMS_OUTPUT.PUT_LINE(i); ';
p_end_plsql := p_end_plsql||' EXCEPTION WHEN OTHERS THEN NULL; ';
p_end_plsql := p_end_plsql||' END; ';
p_end_plsql := p_end_plsql||' END LOOP; ';
p_end_plsql := p_end_plsql||'END; ';

DBMS_OUTPUT.ENABLE(100000);
GO_BLOCK('child');
CLEAR_BLOCK;

v_ol_start := LEAST(NVL(:loc.minimum,1),NVL(:loc.maximum,99999)) ;
v_ol_end := GREATEST(NVL(:loc.minimum,1),NVL(:loc.maximum,9999 9));
v_ol_start := trunc(v_ol_start/5000);
v_ol_end := trunc((v_ol_end-1)/5000);

SET_APPLICATION_PROPERTY(CURSOR_STYLE,'BUSY');
message('0 %',NO_ACKNOWLEDGE);
synchronize;

FOR a in v_ol_start..v_ol_end LOOP
v_l_start := (a*5000)+1;
v_l_end := (a+1)*5000;
IF p_type = 'NORMAL' then
p_mid_plsql := 'FOR i in '||v_l_start||'..'||v_l_end||' LOOP ';
ELSE
p_mid_plsql := 'FOR j in (SELECT DISTINCT to_number(p.spid) j '||
' FROM v$session s, v$process p '||
' WHERE s.paddr=p.addr) loop i := j.j; ';
END IF;
v_temp := v_ol_end - v_ol_start;
IF v_temp != 0 THEN
v_temp := trunc((a - v_ol_start)/v_temp,2);
ELSE
v_temp := 0;
END IF;

FORMS_DDL(p_start_plsql||p_mid_plsql||p_end_plsql) ;
message(to_char(v_temp*100)||' %',NO_ACKNOWLEDGE);
synchronize;
IF NOT FORM_SUCCESS THEN
message('bugger');pause;
END IF;

WHILE p_out_status = 0 LOOP
dbms_output.get_line(v_line, p_out_status);
IF p_out_status = 0 THEN
:child.FILE_NAME := p_file_start||v_line||p_file_end;
NEXT_RECORD;
END IF;
END LOOP;
p_out_status := 0;
IF p_type = 'QUICK' then
EXIT;
END IF;
END LOOP;







Similar Threads
Thread Thread Starter Forum Replies Last Post
Procedure nick1005 MySQL 2 October 18th, 2007 08:41 AM
procedure DARSIN Oracle 6 October 20th, 2004 03:50 AM
Opening forms from other forms Paulsh Access VBA 1 September 30th, 2004 06:54 PM
Procedure ! minhtri Pro VB Databases 2 June 25th, 2004 05:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.