• Post Reply Bookmark Topic Watch Topic
  • New Topic

incrementing the number  RSS feed

navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,my table looks as follows:

id varchar2(10), no number, file_name varchar2(40), file_content blob;

In my application, i will be uploading several files at a time. If u remember Yahoo mail attachments...several attachments are made at once in a page and are posted.

I need to pass a number with it..say like the 1st file attached number would be 1 and it should be incremented corresponding to the number of files attached.

at the end in d/b , it looks like

no file_name file_content
1 xxx.doc blob[]
2 aaa.pdf blbo[]
3 ccc.doc blob[]

I tried it like writing the as follows:

in a method:

public int insertNumber( string id)
connections ...etc..
return i;
} //i wil be getting a number and suppose that it is 1(considering that there are no attachments corresponding to that id).

Now when inserting..

public insert(string id)
int x= insertNumber(id);//i am passing the return type of the previuos method to X.
INSERT INTO TABLE(ID, NO, FILE_NAME, FILE_CONTENT) values( '+id+', +x+, '+fname+', blob);

But, the problem is ..in the d/b i always see 1 as the value under the "NO" field. Normally it should increment!!!

Help please.

Kind Regards,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!