473,657 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to make this function work....

27 New Member
hi.. i have this procedure.. but its not working.. its showing some syntax errors.. how can i make this work.. please help



create or replace function test(text)
returns integer
as
$$
Declare
x varchar;
y varchar;
z varchar;
Begin
z := select xpath('/F/@CT:I',''||$1|| '',ARRAY[ARRAY['CT','urn:Point Cross-ChangeTracker']]);
execute z into y;
return y;
end;
$$
language 'plpgsql';
Jun 9 '08 #1
5 3171
rski
700 Recognized Expert Contributor
hi.. i have this procedure.. but its not working.. its showing some syntax errors.. how can i make this work.. please help



create or replace function test(text)
returns integer
as
$$
Declare
x varchar;
y varchar;
z varchar;
Begin
z := select xpath('/F/@CT:I',''||$1|| '',ARRAY[ARRAY['CT','urn:Point Cross-ChangeTracker']]);
execute z into y;
return y;
end;
$$
language 'plpgsql';
Maybe you'll show that errors. By the way if z is varchar shouldn't you put
Expand|Select|Wrap|Line Numbers
  1. select xpath('/F/@CT:I',''||$1||'',ARRAY[ARRAY['CT','urn:PointCross-ChangeTracker']]);
  2.  
between apos.
Expand|Select|Wrap|Line Numbers
  1. z:='select xpath('/F/@CT:I',''||$1||'',ARRAY[ARRAY['CT','urn:PointCross-ChangeTracker']]);'
  2.  
and why do you write ''||$1||'' are you using there quotation or is it double apos?
Jun 9 '08 #2
ravysters
27 New Member
i am sorry.. i accidentally reported instead of replying...

thanks for the reply...the function is working...

but i have a new problem.. type casting..how can i do that in postgres...
i went through the manual... but wasn't that helpful...

consider the following..

declare x varchar;
execute 'select xpath()' into x;
return x;

how can i convert x from varchar to integer...
help me..
Jun 10 '08 #3
rski
700 Recognized Expert Contributor
i am sorry.. i accidentally reported instead of replying...

thanks for the reply...the function is working...

but i have a new problem.. type casting..how can i do that in postgres...
i went through the manual... but wasn't that helpful...

consider the following..

declare x varchar;
execute 'select xpath()' into x;
return x;

how can i convert x from varchar to integer...
help me..
doesn't simple
Expand|Select|Wrap|Line Numbers
  1. return x::integer
  2.  
work? if not maybe you should write your own cast function.
Jun 10 '08 #4
ravysters
27 New Member
hi.. even after doing that i am gettting this error..

invalid input syntax for integer: ...


i even used select cast( x as integer)..


dint work either man..
Jun 10 '08 #5
rski
700 Recognized Expert Contributor
hi.. even after doing that i am gettting this error..

invalid input syntax for integer: ...


i even used select cast( x as integer)..


dint work either man..
What does
Expand|Select|Wrap|Line Numbers
  1. execute 'select xpath()' into x;
  2.  
produce?
Jun 10 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5739
by: Mike Kamermans | last post by:
I have an XML document that, in order to save b/w for both server and users, uses a few emtpy tags a la "<add/>" and "<edit/>" in the source, which get javascript replaced once the document is done loading into their full form (for <add/>, this would be something like <img src="add.gif" border="0" onClick="javascript:handleEvent(this,'add')">). In order to do this I figured the documented needed to use a few html tags as well (mainly,...
1
4316
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i want to make first text as Table Heading/menu category. For examle in the given menu i want to make a heading as "Comp. Languages" which won't be a link. 2) The position of this menu is absolute to the page. I want to make it absolute to the Table...
7
6275
by: Kapt. Boogschutter | last post by:
I'm trying to create a function that has at least 1 Argument but can also contain any number of Arguments (except 0 because my function would have no meaning for 0 argument). The arguments passed to the function are strings or must be (automaticly converted to a string e.g. the number 10 should become the string "10". My problem is that I can only find samples and description of printf() like functions where the optional arguments and...
0
1632
by: Chris F Clark | last post by:
In our C++ project we have some internal bug reporting macros that we use to get useful information when the program does something unexpected. Essentially at the point of the error, we invoke an internal interactive debugger that knows the classes within our system and allow us to walk around the objects that exist at the time of the fault. It mostly works fairly well. That catch being that we have to hand implement some of the code...
10
6996
by: Nicolas Fleury | last post by:
Hi everyone, I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work: class A: @staticmethod def foo(): pass bar = foo() I understand staticmethod objects don't need to implement __call__ for
6
4866
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
28
2933
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions! PEP: 359 Title: The "make" Statement Version: $Revision: 45366 $ Last-Modified: $Date: 2006-04-13 07:36:24 -0600 (Thu, 13 Apr 2006) $
7
2686
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about the goals -- the make statement is mostly syntactic sugar for:: class <name> <tuple>: __metaclass__ = <callable>
4
2768
by: Kyote | last post by:
I'm trying to persist a list of filenames. I've made a custom collection and a FileName class: 'Class to hold file name information Public Class FileNames Public fullName As String Public fileName As String Public fileExtention As String Public filePath As String Public newName As String
19
2429
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; //every class may have this statement self.hello = function() {
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.