How to get the max sequence number when some record exists in the database table
HelloI need to create the sequence that he should leave value max already exists in the table.
Example:
I have a table as below:
ID NAME
1A
1 a
3 C
4 D
Now, during the creation of sequence it should start from 5 but I should ' t START WITH 5 hard-code in the sequence to create. Is it possible to do without Hardcoding the max value in the sequence. It automatically brings the value max + 1 for the next data when I insert.
CREATE THE TEST_SEQ SEQUENCE. NEXTVAL
START WITH [Max + 1 val of the table]
MAXVALUE 9999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
ALL;
Thank you...
Published by: 998976 on April 18, 2013 04:37
Published by: 998976 on April 18, 2013 04:38
Hello
All the numbers in a CREATE SEQUENCE statement are literals; no other types of numeric expressions are allowed.
You need dynamic SQL statements to do something like what you want. For example:
COLUMN seq_start_col NEW_VALUE seq_start
SELECT 1 + MAX (val) AS seq_start_col
FROM table_x;
CCREATE SEQUENCE TEST_SEQ.NEXTVAL
START WITH &seq_start
MAXVALUE 9999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
Tags: Database
Similar Questions
-
How to get the underlying tables
Hi all
EBS R12.2
How can I get the underlying tables of the following form?
Thank you very much
Jen
Hello
Go to help-> review-> properties-> point.
That's how you get the base table (FND_USER_RESP_GROUPS_INDIRECT):
Kind regards
Bashar
-
How to get the database name/IP address of the server forms10g database
Hello world
How can I get the name of the database instance and the IP address of the database server?
I use GEC 10 g and the database server is Oracle 10 g.
DobbelaereHow can I get the name of the database instance and the IP address of the database server?
To use the IP UTL_INADDR
For example name you can use sys_context ('userenv', 'instance_name')
or
SQL > select instance_name from v$ instance; -
How to get the database create 9iR2 db statement?
Friends,
OS: RHEL 3
DB: Oracle 9iR2
under sql will be the creation of tablespace.
like the above, I want to get the creation of database statementselect dbms_metadata.get_ddl('TABLESPACE','TEMP') from dual;
is it possible using dbms_metadata or any other means?
Thank youThere were a few scripts or references to scripts to generate create statements of database in the past.
I thought that I had actually downloaded one, but I don't know what I did with it. I however did a quick search and found the following:
Of comp.databases.oracle.server. The last entry for the thread refer to such a tool are available on the web pages of the author.
http://groups.Google.com/group/comp.databases.Oracle.Server/browse_frm/thread/a1457c459be3479a/63bcc6008e8273b7?hl=en&lnk=St&q=#63bcc6008e8273b7
You can use the Oracle DBCA utility for fine screens to create a database and output, then save the scripts. You can now take those scripts and change the and adding additional orders for your goal.
HTH - Mark D Powell.
-
How to get the a table check constraint.
I don't see the function to get forced check.
I try the table.getCheckConstraints () function
but I return nothing.Hello
table.getCheckConstraints () will return to check the constraints defined at the Table level in the Data Modeler.
You can also call column.getCheck (). This will return a check constraint defined on a column object in the Data Modeler.
David
-
How to get the new activation key when some numbers are taken away and you have received?
How to get the new activation key when some numbers are taken away and you have received?
Have a laptop with windows 7 from Dell. Need to re install W7. And I have some numbers are taken as a result of its use.How can I get a new code activation or my complete activation code?Best regards, W7 userHow to get the new activation key when some numbers are taken away and you have received?
Have a laptop with windows 7 from Dell. Need to re install W7. And I have some numbers are taken as a result of its use.How can I get a new code activation or my complete activation code?Dell provided you with restore/recovery media and/or a way to restore the machine 'default' as a key sequence? If so - you won't need the number--unless they just sent a DVD of Windows 7 nu - and they are usually not unless you ask.
They have probably installed using their key, which means that even with a utility like Belarc Advisor or ProduKey - you will not get the product key that matches the one on the sticker.
Some may have you take several different digital pictures of the sticker from different angles and see if you can decipher the missing characters like that (you'd be surprised to see how that works).
-
How to get the number of entries in the navigation menu?
How to get the number of entries in the navigation menu? Check the image. What it shows 8 number of customers and 10 products and 10 orders in the list. How to get it?
--
Thank you
Hello
Create items of the request saying, "CUSTOMERS", "PRODUCTS" and "ORDERS".
Create the application process that defines these items when loading the page for example
C1 in select count (*) NTC (of customer_table)
loop
: CUSTOMERS: = c1.cnt;
end loop;
C1 in select count (*) NTC (of products_table)
loop
PRODUCTS: = c1.cnt;
end loop;
C1 in select count (*) NTC (of orders_table)
loop
: ORDERS: = c1.cnt;
end loop;
Components shared Open-> Navigation bar and change:
In the entry list Label-> customers & CLIENTS.]
-
How to get the date of end of week max and its rows of a table
Hello
This table how to get this line by id - name (id and the name of the composite key) whose date is the date of last weekend (last Saturday).Table [temp2] id name dt 123 a 2-mar-2010 124 b 1-feb-2010 125 c 3-apr-2010 123 a 13-mar-2010 125 c 13-mar-2010 123 a 12-feb-2010
for example, suppose to have IDs 123 values date February 12, 2010, 13-mar-2010 this date falls on the last Saturday 13-mar-2010, how to get the value of the line on Saturday last for all the unique id and the name?
So I wrote this but probably there a few traps...
Here I have spent in the in clause 4 last weekend dates manually (although either has been calculated by programming) in front.select id,name,dt from (select id,name,dt,max(dt) over(partition by id,name) as max_date from temp2) t where dt=t.max_date and dt in ('3-apr-2010' ,'27-mar-2010','20-mar-2010','13-mar-2010')
Thank youHere's another option:
SELECT * FROM ( SELECT ID , NAME , MAX(CASE WHEN TO_CHAR(DT,'DY','NLS_DATE_LANGUAGE=ENGLISH') = 'SAT' THEN DT END) AS DT FROM TEMP2 GROUP BY ID, NAME ) WHERE DT IS NOT NULL
It is always useful to provide the following information:
1. oracle version (SELECT * FROM V$ VERSION)
2. examples of data in the form to CREATE / INSERT commands.
3. expected results
4 explanation of the expected results (alias "business logic")
5. use.tags for #2 and #3. See FAQ (Link on top right side) for details.
-
How to get the IP address of the client when TCP connect on the server
How to get the IP address of the client when TCP connect on the server.
The only parameter obtained the login is the login ID.
I assume you are using "Wait of TCP on the listening port" on the server. This returns the remote address and port (like out in option).
-
How to get the number of line of a multi-line string
It seems that this Panel of string does not provide the tool to get the chain line number,
Does anyone have the same experience?
so...
How to get the line number of a variable string?
Number of lines
-
I use lv 8.5 and teststand 4.0.
I did a step type custom and recorded at the MyTypes.ini in pallets of type.
I specified a default module by opening the properties of the custom step of *.ini type window, then I put some values of the parameters.
T1) when I open teststand and I add the custom step type manaully in seq file, the labview module parameter values are represented.
But, if to use file (create and add support prototype stage), the labview module parameter values has the default value.
Using joint file, how to get the setting custom step type values I put in *.ini?
Q2) each type of step are automatically by name through the use of LoadTypePaletteFilesEx. When I open teststand and I add the custom step type manaully in seq file, the module is loaded automatically. Inside the attachment, I use a prototype of charge and a fixed path where the module labview is to load the labview module.
Can I load module automatically without using a prototype of charge or how can I get a dynamic path of type step?
I solved Q1 for myself by using the mapping tab of the parameter within the configuration to the default module window.
Everyone knows Q2?
Thank you.
-
How to get the number of fonts online
Hi all
can you give me solution to the following:
How to get the number of fonts on a line.
Ex
BlackBerry Support 'Community' is supported for my career
in this line, I want to ITALIC for the word 'Community '.
Font.GetDefault (). Derive from wil give for total line...
RichTextField does not?
See this KB article
http://supportforums.BlackBerry.com/T5/Java-development/format-text-in-a-RichTextField/Ta-p/445038
-
How to get the maximum number of days in a month?
How to get the maximum number of days in a month?
I use a dateField. where I can get the month. Now, I want to get the maximum number of days in a month.
How can I get it?
Please help me. and thanks in advance... []
NET. RIM. Device.API.util
Class DateTimeUtilitiesgetNumberOfDaysInMonth (int month, int year)
Returns the number of days in the specified monthIt took me like 10 seconds to find it in the API, I guess you spent more time writing the post...
-
How to get the number and the name of the contacts selector
Hi all
I got the Contact Picker work but I have no idea how to get the selected telephone number and the name.
There are attributes that I can put like contactId.value () to retrieve or there is another way?
Thanks in advance.
ImageButton{ defaultImageSource: "asset:///images/bluebutton.png" onClicked: { contactPicker.open(); } attachedObjects: [ ContactPicker { id: contactPicker onContactSelected: { result.text = "You chose contact: " + contactId; } } ] } Label { id: result text: "You chose contact: " }
Hello
You can get the contact name and phone number as this,
ImageButton{ defaultImageSource: "asset:///images/bluebutton.png" onClicked: { contactPicker.open(); } attachedObjects: [ ContactPicker { id: contactPicker onContactSelected: { result.text = "You chose contact: " + contactId; // call a cpp method to get the details
app.getDetails(contactId); } } ] } Label { id: result text: "You chose contact: " }
the CPP code:
void ContactDetails(ContactId id) { Contact contact_info = m_contactService->contactDetails(id); QString firstName = contact_info.firstName(); QString lastname = contact_info.lastName(); QList
phoneno_list = contact_info.phoneNumbers(); QStringList no_s; foreach(ContactAttribute attr, phoneno_list) { no_s << attr.value(); } } You can get details like this.
Kind regards
Naresh Kodumuri.
-
How to get the event when we change our simcard in BB device
Hi all
Please, someone tell how to get the event or any listener method that can automatically called when we change our SIM card device.
Thanks in advance,
TEJ
Hi Tej,
I came across some post, which may be useful for you
http://supportforums.BlackBerry.com/T5/Java-development/is-SIM-ID-really-exist/m-p/54407#M5954
Maybe you are looking for
-
How to share movies of iphone4 with access to other devices like ios7 and icloud desktop
How do I share movies THST, I bought movies itunes iPhone4 with other devices such as desktop? My iPhone4 ios are 7 and it does not support icloud
-
I have an inextricable mess of 3 mailboxes on three device running EL Capitan and IOS9 crossing not sync. Is there a good step by step instruction?
-
Satellite L300D-12U I take the battery out of it?
Hello I have a question. I bought the toshiba Satellite L300-12U a long time ago and I've always used the adapter, even if the battery was still in it. But I heard that it is best to take it out, when you use the adapter. But if I get out the acuumul
-
I have a 32 GB external SD card in my phone, alongside internal user of 8 GB at the normal address space. When I connect the phone to Windows 7, the device lists a single external storage drive that includes external and internal storage files have b
-
Hi, I want to display the number of success / testing failed in the Testtand of xml report, please help me. Later, my requirement is that I should be able to view the number of test / has not passed in the header of the report too.