Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Today at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Sep 7, 2026
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sep 6, 2026
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
JAVA
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="pradeep0079" data-source="post: 10853568" data-attributes="member: 302518"><p>machen uba kiyanne invoice number eka auto generate karanne kohomada kiyalada like 1,2,3 or 00001,0002,0003 </p><p>is that i will mention some method but this is for enterprise db ,i don't remember mysql so you get the concept and impliment on mysql</p><p></p><p>method 1:</p><p>get the count in invoice table and increment it by one </p><p>select count(*)+1 as serial from yourtable </p><p>this is one method but it has some draw backs</p><p></p><p>second method: </p><p>create a index or sequence </p><p>CREATE SEQUENCE your_seq</p><p> INCREMENT 1</p><p> MINVALUE 1</p><p> MAXVALUE 9223372036854775807</p><p> START 1</p><p> CACHE 1;</p><p>ALTER TABLE your_seq OWNER TO enterprisedb;</p><p></p><p>using sequence you can do it two ways </p><p>1.use it in your insert query </p><p>like insert into your_table(column names) values (,,,,,your_seq.nextval)</p><p>2. use a stored procedure to generate patterned serial</p><p> function fc_get_orderno</p><p>return varchar is </p><p>begin </p><p></p><p>return lpad(seq_your.nextval,4,0);</p><p>end;</p><p>this will return a number like 0001,0002</p><p></p><p>3.use a sepearte table for sequence </p><p>create a tabe with columns srial_name,serial_vale with varchar ,number</p><p>then </p><p>in your code get the serial_vale +1 from your table </p><p>after you have to update it </p><p></p><p>let say you have 30 in your serial_value </p><p>then you get 31 </p><p>then you have to update 31 as your serial value </p><p>but remenber you have to handle concurrency in your code and db </p><p>otherwise this will be a mess</p><p></p><p>i recommend 2 method since db handle the concurrency and i most used it</p></blockquote><p></p>
[QUOTE="pradeep0079, post: 10853568, member: 302518"] machen uba kiyanne invoice number eka auto generate karanne kohomada kiyalada like 1,2,3 or 00001,0002,0003 is that i will mention some method but this is for enterprise db ,i don't remember mysql so you get the concept and impliment on mysql method 1: get the count in invoice table and increment it by one select count(*)+1 as serial from yourtable this is one method but it has some draw backs second method: create a index or sequence CREATE SEQUENCE your_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; ALTER TABLE your_seq OWNER TO enterprisedb; using sequence you can do it two ways 1.use it in your insert query like insert into your_table(column names) values (,,,,,your_seq.nextval) 2. use a stored procedure to generate patterned serial function fc_get_orderno return varchar is begin return lpad(seq_your.nextval,4,0); end; this will return a number like 0001,0002 3.use a sepearte table for sequence create a tabe with columns srial_name,serial_vale with varchar ,number then in your code get the serial_vale +1 from your table after you have to update it let say you have 30 in your serial_value then you get 31 then you have to update 31 as your serial value but remenber you have to handle concurrency in your code and db otherwise this will be a mess i recommend 2 method since db handle the concurrency and i most used it [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom