Dbms_output.put_line and sqlplus : output truncated to 100 Characters.
HI all,
please see the following script where the variable length is more than a 100 charecters...
When i run this in sqlplus with SERVEROUTPUT ON, i see the ouput being truncated to 100 charecters.
sql> ed
Wrote file afiedt.buf
1 declare
2 l_var varchar2(400);
3 begin
4 l_var := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
5 dbms_output.put_line(length(l_var));
6 dbms_output.put_line(l_var);
7* end;
8 /
130
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvI think I am looking for a sqlplus "SET XXXX..." command, but my search has been futile so far.
Please advice.
Thanks,
John.
Thanks for your reply .. Frank.
Sorry... I Previewed the post but did not notice my code being truncated in my sqlplus sesssion.
The actual script has the output to 130 charecters. but when i close the edit (afeidt.buf) and execute it, the display only shows 100 charecters...
My SQLPLUS version is 9.2.0.1.
I am using the "WE8ISO8859P1" charecter set.
declare
l_var varchar2(500) := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
begin
dbms_output.put_line(length(l_var));
dbms_output.put_line(l_var);
end;
130
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv
1 declare
2 l_var varchar2(500) ;
3 begin
4 for i in 1 .. 5 loop
5 l_var := l_var || 'abcdefghijklmnopqrstuvwxyz';
6 end loop;
7 dbms_output.put_line(length(l_var));
8 dbms_output.put_line(l_var);
9* end;
sql> /
130
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv
Similar Messages
-
Hi Guys.
I upgraded from 1.2 and it appears that dbms_output.put_line is now broken.
Consider the following:
begin
dbms_output.put_line('hello world');
end;Process:
1. Load SQL Developer
2. Open a connection to DB
3. Go to DBMS Output tab
4. Enable server output
5. Type in the code (as above)
6. Hit F5
The bug/new feature:
After hitting f5, the DBMS Output tab switches to Script output where by I am presented with "anonymous block completed". In 1.2 (and previous versions) I used to see
anonymous block completed
hello world
in the Script Output tab.
Now I have to switch back to the DBMS Output tab. My problem with this is that there is far too much clicking. Why redirect me away from the tab that is going to actually display the script output only for me to have to click back into that tab? I just don't get it.
Regards
Kristian Jones
http://kristianjones.blogspot.com
Message was edited by:
Kris JonesHi,
I also have the problem with the new Released.
SQL Dev 1.2.0.29.98 upgraded with Check for Updates to 1.2.1.32.00
On Windows XP.
I did exactly as Kris Jones post, using Run Script
but, it seems that my SQL Developer doesn't do anything.
The progress bar is active like processing somthing, well, it processes forever.
I tried to cancel the process (button Cancel), but the panel shows that it is still trying to cancel the process (all buttons are disabled except Cancel), although I can do another select (use CTRL + Enter because F9 doesn't work) within the same SQL Worksheet and the panel goes back to the active panel again.
Well, there must be something wrong with the Run Script.
Since any query or pl/sql block seems running forever if I use Run Script.
I try on the SQL Developer 1.2.0.29.98 (luckily, I still keep the backup, just in case) and it shows the result as wanted.
Is there something wrong within my SQL Developer 1.2.0.32.00?
Or there is some patches which I should download?
Is it another bug?
Many thanks,
Buntoro -
How to spool DBMS_OUTPUT.PUT_LINE from SqlPlus?
Hi,
i have a stored procedure test:
procedure test is
begin
dbms_output.put_line('Test');
dbms_output.put_line('Test2');
dbms_output.put_line('Test3');
dbms_output.put_line('Test4');
dbms_output.put_line('Test5');
end;
I start the stored procedure out of sqlplus:
spool C:\Temp\test.spl;
exec test;
commit;
spool off;
exit;
My problem is no Test or Test2 appeared in the spool file.
What should i do?
thanks a lotcreate or replace procedure hmm as
begin
dbms_output.put_line('Test1');
dbms_output.put_line('Test2');
dbms_output.put_line('Test3');
dbms_output.put_line('Test4');
dbms_output.put_line('Test5');
end;
spool C:\Temp\test.spl;
exec hmm;
spool off;File content is:
Test1
Test2
Test3
Test4
Test5
PL/SQL procedure successfully completed. -
Printing messages in Log File and Output File using Dbms_output.put_line
Hi,
I have a requirement of printing messages in log file and output file using dbms_output.put_line instead of fnd_file.put_line API.
Please let me know how can I achieve this.
I tried using a function to print messages and calling that function in my main package where ever there is fnd_file.put_line. But this approach is not required by the business.
So let me know how I can achieve this functionality.
Regards
SandyWhat is the requirement that doesn't allow you using fnd_file.put_line?
Please see the following links.
https://forums.oracle.com/forums/search.jspa?threadID=&q=Dbms_output.put_line+AND+Log+AND+messages&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
https://forums.oracle.com/forums/search.jspa?threadID=&q=%22dbms_output.put_line+%22+AND+concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
Hello
I will explain the scenario:
In our java web page, we are using three text boxes to enter "Part number,Description and Aircraft type". Every time the user no need to enter all these data. The person can enter any combination of data or only one text box. Actually the output data corresponding to this input entries is from five Oracle table. If we are using a single query to take data from all the five tables, the database will hang. So I written a procedure "SEARCH1",this will accept any combination of values (for empty values we need to pass NULL to this procedure) and output data from all the five tables. When I executing this procedure in SQL editor, the execution is very fast and giving exact result. I used "dbms_output.put_line" clause for outputing multiple records in my procedure. The output variables are "Serial No, part Number, Description, Aircraft type,Part No1,Part No2,Part No3,Part No4". I want to use the same procedure "SEARCH1" for outputing data in java web page.The passing argument I can take from the text box provided in java web page. I am using jdbc thin driver to connect our java web page to Oracle 9i database.
Note1 : If any combination of search item not available, in procedure itself I am outputing a message like "Part Number not found". Here I am using four words ("Part" is the first word,"Number" is the second,"Not" s the third, and "found" is the fourth) for outputing this message.Is it necessary to equalise number of words I am using here to the record outputing eight variable?
Our current development work is stopped because of this issue. So any one familier in this field,plese help me to solve our issue by giving the sample code for the same scenario.
My Email-id is : [email protected]
I will expect yor early mail.
With thanks
Pramod kumar.Hello Avi,
I am trying to solve this issue by using objects. But the following part of code also throwing some warning like "PLS-00302: component must be declared". Plese cross check my code and help me to solve this issue.
drop type rectab;
create or replace type rectype as object(PartNo varchar2(30),Description varchar2(150),AIrcraft_type varchar2(15),status_IPC varchar2(30),status_ELOG varchar2(30),status_SUPCAT varchar2(30),status_AIRODWH varchar2(30));
create or replace type rectab as table of rectype;
create or replace package ioStructArray as
procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab);
end ioStructArray;
create or replace package body ioStructArray as
procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab) is
mdescription varchar2(150);
mpartnum varchar2(30);
mpno varchar2(30);
mdes varchar2(150);
mair varchar2(15);
mstat varchar2(1);
cursor c1 is select partnum,description,aircraft_type from master_catalog where partnum=mpno and aircraft_type=mair and description like ltrim(rtrim(mdes))||'%';
cursor c2 is select partnum from ipc_master where partnum=mpartnum;
cursor c3 is select partnum from fedlog_data where partnum=mpartnum;
cursor c4 is select partnum from superparts where partnum=mpartnum;
cursor c5 is select part_no from supplier_catalog where part_no=mpartnum;
mpno1 varchar2(30);
mpno2 varchar2(30);
mpno3 varchar2(30);
mpno4 varchar2(30);
mpno5 varchar2(30);
maircraft_type varchar2(15);
mstat1 varchar2(30);
mstat2 varchar2(30);
mstat3 varchar2(30);
mstat4 varchar2(30);
begin
mstat:='N';
mpno:=pno;
mdes:=pdes;
mair:=air;
if mpno is not null and mdes is not null and mair is not null then
begin
mstat:='N';
mpno:=pno;
mdes:=pdes;
mair:=air;
for i in c1 loop
mstat:='N';
mstat1:='N';
mstat2:='N';
mstat3:='N';
mstat4:='N';
mpno1:=i.partnum;
mpartnum:=i.partnum;
mdescription:=i.description;
maircraft_type:=i.aircraft_type;
for j in c2 loop
mpno2:=j.partnum;
end loop;
for k in c3 loop
mpno3:=k.partnum;
end loop;
for l in c4 loop
mpno4:=l.partnum;
end loop;
for m in c5 loop
mpno5:=m.part_no;
end loop;
if mpno2=mpartnum then
mstat1:=mpno2;
end if;
if mpno3=mpartnum then
mstat2:=mpno3;
end if;
if mpno4=mpartnum then
mstat3:=mpno4;
end if;
if mpno5=mpartnum then
mstat4:=mpno5;
end if;
if mpno1=mpartnum then
mstat:='Y';
orec.PartNo:=mpno1;
orec.Description:=mdescription;
orec.AIrcraft_type:=maircraft_type;
orec.status_IPC:=mstat1;
orec.status_ELOG:=mstat2;
orec.status_SUPCAT:=mstat3;
orec.STATUS_AIRODWH:=status_AIRODWH;
end if;
end loop;
end;
end if;
end testsch2;
end ioStructArray;
Expecting your early reply.
With thanks
Pramod kumar. -
How to Populate a table with DBMS_OUTPUT.put_line
Hey Guys, it's Xev.
Please only pleasant people reply to this.
I have a PL/SQL Program that searches for strings and then at the end of it it prints out to DBMS_OUTPUT.put_line.
I have the owner, the table_name, the column name and the count, then it goes to DBMS_OUTPUT.put_line
What i want to do, is take the results of DBMS_OUTPUT.put_line and insert it into a table.
Here is the script I am talking about, as you can see it's simple, yet for me it works. I want to take the results of this and insert it into a table. How can i do that??
set serveroutput on size unlimited
execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
DECLARE
FND_GOVIDS INTEGER;
BEGIN
FOR t IN (SELECT owner, table_name, column_name
FROM all_tab_columns
WHERE owner = upper('&SCHEMA_NAME'))
LOOP
BEGIN
EXECUTE IMMEDIATE 'with a as ( select case when REGEXP_LIKE(' || t.column_name ||
--This searches for 8 Alpha Digits
',''^([[:alpha:]]{2}|[[:alpha:]]{4})?[ ]?[0-9]{8}[ ]?([[:alpha:]]{2}|[[:alpha:]]{4})?$'')
then ''Match Found''
else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
select count(*) from a where a.output=''Match Found'' '
INTO FND_GOVIDS ;
IF FND_GOVIDS > 0 THEN
DBMS_OUTPUT.put_line (
t.owner
|| '.'
|| t.table_name
|| ' '
|| t.column_name
|| ' '
|| FND_GOVIDS);
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
'Generic Error '
|| t.column_name
|| ' from '
|| t.owner
|| '.'
|| t.table_name);
END;
END LOOP;
END;Nope, the table is empty....
But it ran without error??!?! Wait a minute, I think i have to commit right? Since it's not straight sql, ok, that's what I am going to try..
set serveroutput on size unlimited
execute DBMS_OUTPUT.ENABLE (buffer_size => NULL);
DECLARE
FND_GOVIDS INTEGER;
BEGIN
FOR t IN (SELECT owner, table_name, column_name
FROM all_tab_columns
WHERE owner = upper('&SCHEMA_NAME'))
LOOP
BEGIN
EXECUTE IMMEDIATE 'with a as ( select case when REGEXP_LIKE(' || t.column_name ||
--This searches for 6 Alpha Digits
',''^([[:alpha:]]|[[:alpha:]]{3})[0-9]{6}$'')
then ''Match Found''
else ''No Match Found'' end as output from ' || t.owner || '.' || t.table_name || ')
select count(*) from a where a.output=''Match Found'' '
INTO FND_GOVIDS ;
/*Table insert for resulting */
IF FND_GOVIDS > 0 THEN
INSERT INTO "SMEG"."DYNAMIC_COUNTS" (T_OWNER, T_TABLE_NAME, T_COLUMN_NAME, FND_GOVIDS) VALUES
('t.owner','t.table_name','t.column_name','FND_GOVIDS');
END IF;
/* dbms_output */
IF FND_GOVIDS > 0 THEN
DBMS_OUTPUT.put_line (t.owner || '.' || t.table_name || ' ' || t.column_name || ' ' || FND_GOVIDS);
END IF;
/* Exception Handeling */
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
'Generic Error '
|| t.column_name
|| ' from '
|| t.owner
|| '.'
|| t.table_name);
END;
END LOOP;
END; -
Output from dbms_output.put_line splits and move to next line
Hi All,
I am printing out a list using dbms_output.put_line its like
One or more of following Required Parameters are missing:
1. Primary Field
2. Structure Field
3. Structure
Table
4. List File Name
5. Query Directory
6. Query String
but I don't know why third option is splitting and moving to second line. any idea? its not that long even then.
thanksset linesize 150
or set it as per your requirement -
Dbms_output.put_line truncate leading space?
Hi guys,
I am using Oracle 9i R2. Does anyone know that if 9i R2 dbms_output.put_line will truncate the leading space from a output line? I am running the function directly from sqlplus. Is it a default behaviour and could it be changed?
Thanks for your help in advance.This is the default behaviour and very annoying it is too. AFAIK there is no way of switching this behaviour off (I'd be happy to be proved wrong on this). The following sample offers two workarounds - use of a leading character and use of an ASCII tab. Neither's idea, so take your pick.
Cheers, APC
SQL> set serveroutput on
SQL> begin
2 dbms_output.put(' ');
3 dbms_output.put_line('hi!');
4 dbms_output.put('. ');
5 dbms_output.put_line('hi!');
6 dbms_output.put(chr(9));
7 dbms_output.put_line('hi!');
8* end;
hi!
. hi!
hi!
PL/SQL procedure successfully completed.
SQL> -
Pro*Cobol and DBMS_OUTPUT.PUT_LINE
I am new to Pro*Cobol and had a simple question (I hope).
I have a stored proc that contains DBMS_OUTPUT.PUT_LINE stmts
and I can see those in SQLPlus (when serveroutput=on), but I do
not see them when I call it from Pro*Cobol. Is there a
precompiler setting or something I need to set?'Far as I know, you'll have to repeatedly call
dbms_output.get_line in your Pro*Cobol program to
get the server output generated by your stored procedure.
Hope that helps.
All the best
Michael -
Output variable value (DBMS_OUTPUT.PUT_LINE)
Hello,
I just started using ORACLE and am learning about PL/SQL. My question is how do you output a variable? I am running the following in an SQL Worksheet, but I can't output the value:
DECLARE
v_Temp VARCHAR2(200);
BEGIN
v_Temp :='help me';
DBMS_OUTPUT.PUT_LINE(v_Temp);
DBMS_OUTPUT.PUT_LINE('Text In Single');
END;
Thanks, sck10SQL> DECLARE
2 v_Temp VARCHAR2(200);
3
4 BEGIN
5 v_Temp :='help me';
6 DBMS_OUTPUT.PUT_LINE(v_Temp);
7 DBMS_OUTPUT.PUT_LINE('Text In Single');
8 END;
9 /
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> /
help me
Text In Single
PL/SQL procedure successfully completed.
SQL> Nicolas. -
Print and dbms_output.put_line
wats the diff between prin and dbms_output.put_line
BEDE wrote:
Do not expect that the dbms_output.put or .put_line output show while the procedure or PL/SQL block is running. It will show only after it finished running.Unless something else within that PL/SQL execution reads the dbms_output buffer and directs the output somewhere where it can be read during run-time, such as putting it onto a table using an autonomous transaction or putting it out using a web service to another destination etc. Although generally, people don't do that I agree, but it can be done if required. -
DBMS_Output.put_line doesn't print in one single line
Hi People,
I am using 'DBMS_Output.put_line' in my procedure for the output. Here's the code:
DBMS_OUTPUT.put_line('LOGIT_T. Detail records for act:'||v_count_act||',Detail records for Bal:'||v_count_bal||',Updated records for act:'||v_updat_act||',Updated records for bal:'||v_updat_bal||',Total records for act:'||v_count_act||',Total records for Bal:'||v_count_bal);
When the procedure runs, it prints the output as shown below:
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records
for act:0,Updated records for bal:0,Total records for act:693,Total records for
Bal:410
As a result, when inserting this whole line into table, it only inserts the following text. Hence, ignores the rest of the text (table field width is 2000 bytes):
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records
Looks like, it is automatically wrapping the text to the next line. While I want the above output in a single line as shown below and to be inserted into my table the whole text:
LOGIT_T. Detail records for act:619,Detail records for Bal:324,Updated records for act:0,Updated records for bal:0,Total records for act:693,Total records for Bal:410
Any idea how to achieve this? Any parameter or setting I am missing here?
Hope I made sense above and clearly described my situation.
Thanks in advance guys!in sqlplus, you can use set linesize:
SQL> set serverout on
SQL> set linesize 10
SQL> exec dbms_output.put_line('This is a line of text that exceeds 10 characters');
This is a
line of
text that
exceeds 10
characters
PL/SQL procedure successfully completed.
SQL> set linesize 132
SQL> exec dbms_output.put_line('This is a line of text that exceeds 10 characters');
This is a line of text that exceeds 10 characters
PL/SQL procedure successfully completed. -
Dbms_output.put_line not printing in inner for loop using a parameter
I cannot get the inner loop to print output. I can run both loops independent (hardcoding a value for the inner loop) Any help is apprecicated... Listed is the code
set serveroutput on
DECLARE
cursor ACCNO_CUR is
select accession_number from didb_studies where insert_time > to_date('02-JUN-12');
cursor PATH_CUR (p1_accno VARCHAR2) is
select distinct l.FILE_SYSTEM || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME
, l.image_size
, i.image_need_backup
, i.sop_class_uid
from medistore.didb_studies s
, medistore.didb_raw_images_table i
, medistore.didb_image_locations l
where s.accession_number = 'p1_accno'
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null and INSTR(l.file_system, '.img') = 0
UNION
select distinct(l.FILE_SYSTEM) as FULLY_QUALIFIED_IMAGE_NAME
, l.image_size
, i.image_need_backup
, i.sop_class_uid
from medistore.didb_studies s, medistore.didb_raw_images_table i,
medistore.didb_image_locations l
where s.accession_number = 'p1_accno'
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null and INSTR(l.file_system, '.img') > 0
order by 1;
BEGIN
FOR accno_rec in accno_cur LOOP
DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
FOR path_rec in path_cur(accno_rec.accession_number) LOOP
DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
END LOOP;
END LOOP;
END;Maybe
DECLARE
cursor ACCNO_CUR is
select accession_number
from didb_studies
where insert_time > to_date('02-JUN-12');
cursor PATH_CUR (p1_accno VARCHAR2) is
select distinct
l.FILE_SYSTEM || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME,
l.image_size,
i.image_need_backup,
i.sop_class_uid
from medistore.didb_studies s,
medistore.didb_raw_images_table i,
medistore.didb_image_locations l
where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null
and INSTR(l.file_system, '.img') = 0
UNION
select distinct
l.FILE_SYSTEM as FULLY_QUALIFIED_IMAGE_NAME,
l.image_size,
i.image_need_backup,
i.sop_class_uid
from medistore.didb_studies s,
medistore.didb_raw_images_table i,
medistore.didb_image_locations l
where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
and s.study_db_uid = i.study_db_uid
and i.raw_image_db_uid = l.raw_image_db_uid
and l.file_system is not null and INSTR(l.file_system, '.img') > 0
order by 1;
BEGIN
FOR accno_rec in accno_cur
LOOP
DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
FOR path_rec in path_cur(accno_rec.accession_number)
LOOP
DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
END LOOP;
END LOOP;
END;Regards
Etbin -
I am using Oracle 10.1.0.4.2 SQL Plus, and dbms_output.put_line is not working. It returns the dbms_output ONLY from outside the procedure. I have dbms_output INSIDE my procedure, and none of it gets returned. Please help!
Here is what I enter:
set serveroutput on size 1000000;
DECLARE
x number:=0;
begin
DBMS_OUTPUT.ENABLE;
c2reports.c2proc(x,'TEST');
DBMS_OUTPUT.PUT_LINE('testX');
END;
testX
There should be more besides the 'testX' that gets returned. The first line in my procedure has output code to print testY. Thanks in advance!This is the forum for the Oracle's SQL Developer (Not for general SQL/PLSQL questions). You should ask question like this in the PL/SQL forum
-
DBMS_OUTPUT.PUT_LINE
Hello I need a Help.
I use PHP Version 4.4.0 and Oracle 10g
I have create this procedure with php
$node_start = 670;
$node_end = 677;
$conn = @OCILogon("My_db", "My_pass", "My_host") or die ( "Connect KO to server <b>$My_host</b>!");
$plsql = "create or replace PROCEDURE PERCORSOSTRADA AS "
." path_id NUMBER;"
." res_numeric NUMBER;"
." res_array SDO_NUMBER_ARRAY;"
." indx NUMBER;"
." BEGIN"
." sdo_net_mem.network_manager.read_network('SDO_RETE_STRADALE', 'FALSE');"
." path_id := sdo_net_mem.network_manager.shortest_path('SDO_RETE_STRADALE', $node_start, $node_end);"
." res_array:= sdo_net_mem.path.get_node_ids('SDO_RETE_STRADALE', path_id);"
." DBMS_OUTPUT.PUT('This path has the following nodes: ');"
." FOR indx IN res_array.FIRST..res_array.LAST"
." LOOP"
." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
." END LOOP;"
." DBMS_OUTPUT.PUT_LINE(' ');"
." res_array:= sdo_net_mem.path.get_link_ids('SDO_RETE_STRADALE', path_id);"
." DBMS_OUTPUT.PUT('This path has the following links: ');"
." FOR indx IN res_array.FIRST..res_array.LAST"
." LOOP"
." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
." END LOOP;"
." DBMS_OUTPUT.PUT_LINE(' ');"
." END PERCORSOSTRADA;"
$s = OCIParse($conn, $plsql);
$istruzione = @OCIExecute($s);
This procedure run successfully
If I use sql*plus I have this result
-This path has the following nodes: 670 674 673 676 677
-This path has the following links: 824 818 2925 874
What I must to do for have the same result using a script php?
I have tried to read The Underground PHP and Oracle® Manual Release 1.4
of CHRISTOPHER JONES AND ALISON HOLLOWAY
but I am not able to find the right way.
Thank you in advance!
Edited by: angelo_z on Sep 8, 2008 12:34 PMExcuse me but I don't understand what I must to do after created this procedure: PERCORSOSTRADA
$node_start = 670;
$node_end = 677;
$conn = @OCILogon("My_db", "My_pass", "My_host") or die ( "Connect KO to server $My_host!");
$plsql = "create or replace PROCEDURE PERCORSOSTRADA AS "
." path_id NUMBER;"
." res_numeric NUMBER;"
." res_array SDO_NUMBER_ARRAY;"
." indx NUMBER;"
." BEGIN"
." sdo_net_mem.network_manager.read_network('SDO_RETE_STRADALE', 'FALSE');"
." path_id := sdo_net_mem.network_manager.shortest_path('SDO_RETE_STRADALE', $node_start, $node_end);"
." res_array:= sdo_net_mem.path.get_node_ids('SDO_RETE_STRADALE', path_id);"
." DBMS_OUTPUT.PUT('This path has the following nodes: ');"
." FOR indx IN res_array.FIRST..res_array.LAST"
." LOOP"
." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
." END LOOP;"
." DBMS_OUTPUT.PUT_LINE(' ');"
." res_array:= sdo_net_mem.path.get_link_ids('SDO_RETE_STRADALE', path_id);"
." DBMS_OUTPUT.PUT('This path has the following links: ');"
." FOR indx IN res_array.FIRST..res_array.LAST"
." LOOP"
." DBMS_OUTPUT.PUT(res_array(indx) || ' ');"
." END LOOP;"
." DBMS_OUTPUT.PUT_LINE(' ');"
." END PERCORSOSTRADA;"
$s = OCIParse($conn, $plsql);
$istruzione = @OCIExecute($s);
I have not clear next steps.
I'm doing this:
function SetServerOutput($conn, $p)
if ($p)
$s = "BEGIN DBMS_OUTPUT.ENABLE(NULL); END;";
else
$s = "BEGIN DBMS_OUTPUT.DISABLE(); END;";
$s = OCIparse($conn_obgeo, $s);
$r = OCIexecute($s);
OCIfreestatement($s);
return $r;
function GetDbmsOutput($conn)
$res = false;
$s = OCIparse($conn_obgeo, "BEGIN DBMS_OUTPUT.GET_LINE(:LN, :ST); END;");
if (ocibindbyname($s, ":LN", $ln, 255) &&
ocibindbyname($s, ":ST", $st)) {
$res = array();
while (($succ = ociexecute($s)) && !$st)
$res[] = $ln;
if (!$succ)
$res = false;
ocifreestatement($s);
return $res;
SetServerOutput($conn, true);
// Create some output
$s = ociparse($conn_obgeo, "call dbms_output.put_line('Hello, world!')");
ociexecute($s);
// Display the output
$output = GetDbmsOutput($conn);
foreach ($output as $line)
echo "$line<br>";
But What I must to do, what I must write instead of 'Hello, world!'?
I must create a function myfunc?
$plsql_fun = "create or replace package mypack AS "
." function myfunc(i_p in number) return varchar2;"
." end mypack;"
$s = OCIParse($conn, $plsql_fun);
$istruzione = @OCIExecute($s);
and then I must call procedure?
$call_procedura = OCIParse($conn, "call PERCORSOSTRADA()");
OCIexecute($call_procedura);
and then ???
$stmt = OCIparse($conn, "begin :ret := mypack.myfunc(); end;");
OCIbindbyname($stmt, ':ret', $r, 20);
OCIexecute($stmt);
echo "Name is: ".$r;
Thank you in advance!
Maybe you are looking for
-
VSS timeouts on Hyper-V guest, Exchange Replication Service, CU5
I'm having a problem with a Hyper-V guest that is running Exchange 2013 CU5. I will say I have had issues with this VM since installing CU5. Note: I am doing a backup from within the VM guest, not from the host. The scheduled backup takes a long ti
-
File Upload and Download in Oracle iAS PL/SQL Gateway
i'm using the example 113471.1 to "File Upload and Download in Oracle iAS PL/SQL Gateway" when i press the submit button after i select a file to upload i get the next message in the browser "No se puede mostrar la pagina" HTTP 404 file not found. I
-
Jumpy Video over imported audio clips on time line.
I have faltering or jumpy video occurring only where I have imported music. this has never happened before. It happens on all music even aiff. I need help, cant finish last DVD in a sequence of five.
-
Which version on photoshop elements do I need?
Which version of photoshop elements will open raw NEF files from a Nikon D300s?
-
WRTG54g v5 No desktop (wired) connection but have working wirless connection
I have the router (wrtg54g v5) supporting a notebook wireless and gateway windows xp desktop thru an ethernet cable. Internet service is thru a cable modem. All was well for months. Now I can't access the internet on the desktop but still have int