how can I use String.IndexOf method to find the correct value?
I want to make my sentence like below, but how can I use String.IndexOf
method to find the correct value of MINVALUE to make start with value
change in sentence with given conditions?
sentence
CREATE SEQUENCE "MY_TEST_SEQUENCE" MINVALUE 8 MAXVALUE 999 INCREMENT BY 1
START WITH 55 CACHE 20 NOORDER NOCYCLE
result
***CREATE SEQUENCE "MY_TEST_SEQUENCE" MINVALUE 8 MAXVALUE 999 INCREMENT BY
1 START WITH 8 CACHE 20 NOORDER NOCYCLE***
Conditions
if MINVALUE has plus value (8) than make start with value same as MINVALUE
(8)...
if MINVALUE has minus (-8) value than make start with value same as
MAXVALUE (999)
My Code
var startvalue = 0;
if(MINVALUE > 0)
{
startvalue = MINVALUE;
}
Else if(MINVALUE < 0)
{
startvalue = MAXVALUE;
}
var result = String.Format(@"CREATE SEQUENCE ""MY_TEST_SEQUENCE"" MINVALUE
8 MAXVALUE 999 INCREMENT BY 1 START WITH {0} CACHE 20 NOORDER
NOCYCLE",startvalue)
No comments:
Post a Comment