473,408 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problem regarding a function

priyan
54
Hi all,
I am having a table, in that a column called code contains a character varying datatype and has subject code in it.....
subject code will be in the form
Expand|Select|Wrap|Line Numbers
  1. 001
  2. 001.01
  3. 001.02
  4. 02345.01
  5. 002.01
  6. 001.01.01
  7. 001.01.02
  8.  
here i want to retrieve only the rows having code with one '.' dot ie., i have to retreive rows having code as 001,002,02345.

please help me......

Thanks in advance
priyan....
Oct 2 '07 #1
5 2480
rski
700 Expert 512MB
Hi all,
I am having a table, in that a column called code contains a character varying datatype and has subject code in it.....
subject code will be in the form
Expand|Select|Wrap|Line Numbers
  1. 001
  2. 001.01
  3. 001.02
  4. 02345.01
  5. 002.01
  6. 001.01.01
  7. 001.01.02
  8.  
here i want to retrieve only the rows having code with one '.' dot ie., i have to retreive rows having code as 001,002,02345.

please help me......

Thanks in advance
priyan....
I am not sure if I get your problem but maybe it is want you want

select * from tablename where code ~ '^[^.]*\\.[^.]*$';
See here
http://www.postgresql.org/docs/curre...-matching.html
Oct 2 '07 #2
priyan
54
I am not sure if I get your problem but maybe it is want you want

select * from tablename where code ~ '^[^.]*\\.[^.]*$';
See here
http://www.postgresql.org/docs/curre...-matching.html


thank u rski for helping me but i am having another doubt can i retrieve rows from the same table where the code has two dots...ie.,
Expand|Select|Wrap|Line Numbers
  1. 001.01.01
  2. 002.01.02
  3.  
Please help me
Oct 2 '07 #3
priyan
54
thank u rski for helping me but i am having another doubt can i retrieve rows from the same table where the code has two dots...ie.,
Expand|Select|Wrap|Line Numbers
  1. 001.01.01
  2. 002.01.02
  3.  
Please help me
Thank u rski i got the answer thank u verymuch....but if u explain me why we are using such an expression it would be very useful for me and i would be verymuch greatful to u.....
Thanks
priyan
Oct 2 '07 #4
rski
700 Expert 512MB
thank u rski for helping me but i am having another doubt can i retrieve rows from the same table where the code has two dots...ie.,
Expand|Select|Wrap|Line Numbers
  1. 001.01.01
  2. 002.01.02
  3.  
Please help me
Simple

select * from tablename where code ~ '^[^.]*\\.[^.]*\\.[^.]*$';
And read what is written on the site
http://www.postgresql.org/docs/curre...-matching.html
Oct 2 '07 #5
priyan
54
Hi rski,
Thank u very much for helping me
Priyan
Oct 9 '07 #6

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

Similar topics

2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
9
by: SB | last post by:
Ok, very simple problem. I'm trying to update a value by calling a function using pass by reference, but it does not update the value. In short, the value I'm trying to update is balance, which is...
6
by: NoCopy na | last post by:
Using the following example: domiframetest.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
by: dibyendu_k | last post by:
Hi, There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box. From a webpage if I open a popup window (window.open()) containing buttons Print and...
37
by: priya | last post by:
Hi all, I am using strdup() in my c program..But I am having some pr0blem while using the free() in my c code.here I am pasting the my code. #include <stdio.h>
1
by: sapkal.manish | last post by:
Question : How can I find actual row position of DataTable in DataGridView when DataTable is sorted / My source code like this Private WithEvent dgvInwDet as new DataGridView Private...
21
by: cmd | last post by:
I have code in the OnExit event of a control on a subform. The code works properly in this instance. If, however, I put the same code in the OnExit event of a control on a Tab Control of a main...
3
by: ryan.mitchley | last post by:
Hi all I have a class (cPort) that is designed to receive objects and, depending on the type, call a handler (callback) in any descendant of a cProcessBlock class. Callback functions take a...
1
by: vasilip | last post by:
Can anyone help me out with these two issues I seem to be having? using the db2 driver for PHP (db2_xxxxxx) functions 1. If I forget, or for some reason db2_commit/db2_rollback doesn't get...
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.