Home » Developer & Programmer » Forms » help me errors about form (Forms , plsql)
help me errors about form [message #514850] Wed, 06 July 2011 22:05 Go to next message
dophuong_cs
Messages: 92
Registered: May 2011
Location: Viet Nam
Member

I hava a program follow:
Declare
	c_Where Varchar2(32767) := Null;
       Cursor Cur_Xml_Ngay(c_codition varchar2) Is
		Select Column_Value
		From   Table(Sys.Get_Dir_List('/home/oracle/xml/*.xml'))
		Where  1 = 1 || c_codition;
Begin
  If :Blk_Cv11_Control.Txt_Tu_Ngay is not null Then
		c_Where:=c_Where||'	And To_Date(Substr(Column_Value, Instr(Column_Value,'
		||'''-'''||', -1) + 1, Length(Column_Value) - 4 - Instr(Column_Value, '
		||'''-'''||', -1)),'||'''rrrr/mm/dd:hh:mi:ss'''
		||') >= to_date(:Blk_Cv11_Control.Txt_Tu_Ngay,'||'''dd/mm/rrrr'''||')';
	End If;
		Go_Block('blk_cv12_xml');
		Clear_Block;
		For v_Xml In Cur_Xml_Ngay(c_where) Loop
			:Blk_Cv12_Xml.Txt_Ten_File_Xml := Substr(v_Xml.Column_Value, Instr(v_Xml.Column_Value, '/', -1) + 1,
																  Length(v_Xml.Column_Value) - 4 - Instr(v_Xml.Column_Value, '/', -1));
			:Blk_Cv12_Xml.Txt_Duong_Dan    := v_Xml.Column_Value;
			Next_Record;
			Exit When Cur_Xml_Ngay%Notfound;
		End Loop;
		First_Record;
End;



When i run program on fomrs
Re: help me errors about form [message #514859 is a reply to message #514850] Thu, 07 July 2011 00:08 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Can't tell for sure, but INVALID NUMBER might be result of
'	And To_Date(Substr(Column_Value, Instr(Column_Value,'
		||'''-'''||', -1) + 1, Length(Column_Value) - 4 - Instr(Column_Value, '
		||'''-'''||', -1)),'||'''rrrr/mm/dd:hh:mi:ss'''
		||') >= to_date(:Blk_Cv11_Control.Txt_Tu_Ngay,'||'''dd/mm/rrrr'''||')'
part of your code. Try to display it (MESSAGE built-in, or put its value into an item large enough) and see whether it evaluates to a valid condition. Post it here, if that's not a problem.

Also, in the future, try to format your code. True - you enclosed it into [code] tags, but it is unformatted and difficult to follow.
Re: help me errors about form [message #514865 is a reply to message #514859] Thu, 07 July 2011 01:06 Go to previous messageGo to next message
luc_tran
Messages: 31
Registered: October 2010
Location: Viet Nam
Member

dophuong_cs,

What's the value of Column_Value at runtime? Check your substr function, it might result in a invalid date string
Re: help me errors about form [message #514891 is a reply to message #514859] Thu, 07 July 2011 03:48 Go to previous messageGo to next message
dophuong_cs
Messages: 92
Registered: May 2011
Location: Viet Nam
Member

Declare
	c_Where Varchar2(32767) := Null;
	Cursor Cur_Xml_Ngay(c_Dieu_Kien Varchar2) Is
		Select Column_Value From Table(Sys.Get_Dir_List('/home/oracle/xml/*.xml')) Where 1 = 1 || c_Dieu_Kien;
Begin
	
	------------------
	If :Blk_Cv11_Control.Txt_Tu_Ngay Is Not Null Then
		c_Where := c_Where || '     And      To_Date(Substr(Column_Value, Instr(Column_Value,' || '''-''' ||
					  ', -1) + 1, Length(Column_Value) - 4 - Instr(Column_Value, ' || '''-''' || ', -1)),' || '''rrrr/mm/dd:hh:mi:ss''' ||
					  ') >=to_date(' || Chr(39) || To_Char(:Blk_Cv11_Control.Txt_Tu_Ngay, 'dd/mm/rrrr') || Chr(39) || ',' || '''dd/mm/rrrr''' || ')';
	End If;
	Go_Block('blk_cv12_xml');
	Clear_Block;
	For v_Xml In Cur_Xml_Ngay(c_Where) Loop
		:Blk_Cv12_Xml.Txt_Ten_File_Xml := Substr(v_Xml.Column_Value, Instr(v_Xml.Column_Value, '/', -1) + 1,
															  Length(v_Xml.Column_Value) - 4 - Instr(v_Xml.Column_Value, '/', -1));
		:Blk_Cv12_Xml.Txt_Duong_Dan    :=        v_Xml.Column_Value;
		Next_Record;
		Exit When Cur_Xml_Ngay%Notfound;
	End Loop;
	First_Record;
	---------------------------
End;

what has cursor errors?


-----------------
The "curor"
Re: help me errors about form [message #514896 is a reply to message #514891] Thu, 07 July 2011 03:57 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm afraid I don't understand the purpose or question posted in your last message.
Re: help me errors about form [message #514899 is a reply to message #514896] Thu, 07 July 2011 04:01 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
    Select Column_Value From Table(Sys.Get_Dir_List('/home/oracle/xml/*.xml')) Where 1 = 1 || c_Dieu_Kien;

You can't append bits to the where clause of explicit cursors like that.
You need to use execute immediate or a ref cursor.
Re: help me errors about form [message #514900 is a reply to message #514896] Thu, 07 July 2011 04:02 Go to previous messageGo to next message
dophuong_cs
Messages: 92
Registered: May 2011
Location: Viet Nam
Member

i want to you check for command in "cursor" in my program.
Re: help me errors about form [message #514907 is a reply to message #514899] Thu, 07 July 2011 04:28 Go to previous messageGo to next message
dophuong_cs
Messages: 92
Registered: May 2011
Location: Viet Nam
Member

now, i want to create a dynamic cursor in oracle form 10g. How do i do?
Re: help me errors about form [message #514911 is a reply to message #514899] Thu, 07 July 2011 04:39 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Thu, 07 July 2011 10:01

You need to use execute immediate or a ref cursor.


Read up on them in the documentation
Previous Topic: retrieving dynamic values forms
Next Topic: Problem with a template word and client_ole2
Goto Forum:
  


Current Time: Mon Sep 16 12:31:43 CDT 2024