niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Tools
What this code do step by step?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
khusraqazi
*nix forums beginner


Joined: 13 Jul 2006
Posts: 1

PostPosted: Thu Jul 13, 2006 7:56 am    Post subject: What this code do step by step? Reply with quote

Hi,
I am newcomer in Oracle Forms Programming.
Please let me know step by step what does this whole code do in this
procedure?
Why this message ('bugger') pause; as a code used in this procedure?
I will appreciate this very much.

KQ


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,99999));
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;
Back to top
psoug
*nix forums Guru


Joined: 15 May 2005
Posts: 3492

PostPosted: Thu Jul 13, 2006 3:28 pm    Post subject: Re: What this code do step by step? Reply with quote

khusraqazi wrote:
Quote:
Hi,
I am newcomer in Oracle Forms Programming.
Please let me know step by step what does this whole code do in this
procedure?
Why this message ('bugger') pause; as a code used in this procedure?
I will appreciate this very much.

KQ


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,99999));
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;

The code is not completed. The message is just something intended
to pop up and let the developer know there was an exception raised.

Without knowing a lot more about what other blocks are doing, and
the application, it is impossible to tell what else may or may
not be incomplete but the code looks suspect to me.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Back to top
Andy Hassall
*nix forums Guru


Joined: 20 Feb 2005
Posts: 874

PostPosted: Thu Jul 13, 2006 9:37 pm    Post subject: Re: What this code do step by step? Reply with quote

On 13 Jul 2006 00:56:34 -0700, "khusraqazi" <khusraqazi@yahoo.com> wrote:

Quote:
Why this message ('bugger') pause; as a code used in this procedure?
I will appreciate this very much.

Was this code written by someone in the UK, or has this expression of dismay
spread further around the world? (etymology being more interesting than tracing
through a block of code)

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Sun Nov 23, 2008 12:15 pm | All times are GMT
navigation Forum index » Databases » Oracle » Tools
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Where is this code not freeing memory ? jithoosin C++ 2 Fri Jul 21, 2006 9:39 am
No new posts Where is this code not freeing memory ? jithoosin C++ 1 Fri Jul 21, 2006 9:27 am
No new posts Where is this code not freeing memory ? jithoosin C++ 1 Fri Jul 21, 2006 9:12 am
No new posts Where is this code not freeing memory ? jithoosin C++ 0 Fri Jul 21, 2006 9:09 am
No new posts Code problem Sikandar C 1 Fri Jul 21, 2006 4:21 am

Mortgage | Mortgage Loans | Home Insurance | Remortgages | Best Credit Cards
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1538s ][ Queries: 16 (0.0661s) ][ GZIP on - Debug on ]