Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print formatting a long fetched from Oracle

Status
Not open for further replies.

jwleger

Programmer
Nov 10, 2003
8
US
I have fetched a long, but have been unable to print it in a format that useful. I want to print it as it was before it was stored. I find that if I write it to a file it looks fine and then I could read it back in, but would prefer to create a array of print lines for browsing. I have also tried split, and many different regex matching methods to no avail. The long I am fetching is the column "TEXT_BODY" from the DBA_TRIGGERS view.

The particular long I am using to test should format to 26 lines. I have LongReadLen=512k and LongTruncOk=1. I have used smaller LongReadLen values also.

Thanks in advance
 
what does it look like now and what do you want it to look like!?

example(s)?

you are asking a very database specific question on a Perl forum - it would be ALOT easier with something to work with :)


Kind Regards
Duncan
 
Sorry about no example, here it is, and the column name is TRIGGER_BODY.
Here is what it looks like when fetched
==========================================================
BEGIN
IF ax_setup_pkg.ax_exists
:)NEW.org_id
,NULL
,200) THEN
ax_utility_pkg.trace ('> Trigger AX_AP_HOLDS_ARU1' ,10);

ax_payables_pkg.count_holds
(p_org_id => :NEW.org_id
,p_invoice_id => :NEW.invoice_id
,p_hold_lookup_code => :NEW.hold_lookup_code
,p_function_code => 2);

ax_utility_pkg.trace ('< Trigger AX_AP_HOLDS_ARU1' ,10);
END IF;

EXCEPTION
WHEN ax_exceptions_pkg.application_exception THEN
RAISE;
WHEN OTHERS THEN
ax_message_pkg.raise_message ('AX' , 'AX_56000_COMM_TRIG_EXCEPT'
,'TRIGGER_NAME', 'AX_AP_HOLDS_ARU1'
,'ERROR' ,sqlerrm);
END AX_AP_HOLDS_ARU1;
=========================================================
I want it to look like the following, and it does look like this when I write it to a flat file. I am using AIX 5L
-------------------
IF ax_setup_pkg.ax_exists
:)NEW.org_id
,NULL
,200) THEN
ax_utility_pkg.trace ('> Trigger AX_AP_HOLDS_ARI1' ,10);

ax_payables_pkg.count_holds
(p_org_id => :NEW.org_id
,p_invoice_id => :NEW.invoice_id
,p_hold_lookup_code => :NEW.hold_lookup_code
,p_function_code => 1);

ax_utility_pkg.trace ('> Trigger AX_AP_HOLDS_ARI1' ,10);
END IF;

EXCEPTION
WHEN ax_exceptions_pkg.application_exception THEN
RAISE;
WHEN OTHERS THEN
ax_message_pkg.raise_message ('AX' , 'AX_56000_COMM_TRIG_EXCEPT'
,'TRIGGER_NAME', 'AX_AP_HOLDS_ARI1'
,'ERROR' ,sqlerrm);
END AX_AP_HOLDS_ARI1;

/
-----------
Thanks again.
 
Thanks, but I figured it out. Didn't see the \n's earlier.
Below: $nxt_ln has the fetched long
=============================
while ($nxt_ln =~ m/\n/g) {

if ($i == 0) {
$old_pos = 0;
} else {
$old_pos = $start_pos ;
}
$start_pos = pos $nxt_ln;
$trig_data = substr($nxt_ln,$old_pos,$start_pos);
$trig_data =~ s/^\W//;
$i = $i + 1;
@test_data[$i] = $trig_data;
}
------
Then use @test_data when needed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top