i have a PL/SQL procedure using MERGE :
MERGE INTO
table_dest d
USING
(SELECT * FROM my_Table) s
ON
(s.id = d.id)
when matched then UPDATE set d.col1 = s.col1
when not matched then INSERT (id, col1) values (s.id, s.col1);
now lets say the query s returns mutiple rows with same id wich will returns an ORA-00001: unique const...
e.g. I have a table:
create table test (testdata varchar2(255));
then I need an autoincrement field:
alter table test add id numeric(10);
create sequence test_seq
start with 1
increment by 1
nomaxvalue;
create trigger test_trigger
before insert on test
for each row
begin
select test_seq.nextval into :new.id from dual;
end;
wh...
I'm working with a legacy database which due to poor management and design has had a wildgrowth of columns which never have been or are no longer beeing used.
Is it possible to some how query for column usage? As in how often a column is beeing selected (either specifically or with *, or joined on)?
Seems to me like this is something w...
Hello,
I'm currently creating a Rails app with some cronjobs etc, but I have some problems because the sql is cached by Rails.
So anyone know how to disable the SQL Cache in Rails? Not globally, but for this code. Really don't want to create one method for every model, so is there anyway to just disable it temporary?
Terw
...
When using Oracle you can create a disabled trigger specifing the word DISABLE before the trigger body. How can I achive the same effect in Sql Server?
...
Hello,
I'm writing an HQL query, in the form of:
from a where ... or exists (from b inner join b.c where ...) and ...
I get back an entity of type a from this query. However, I need to also know whether the exists clause came back true or not later on in my code. If this was SQL, I'd tack it onto the select list. However, even if I a...
Say I wanted to perform an update in a database that held information on for example cars in a table by that same name.
The update I am looking to perform consists in changing the designation in the table in model from "Ford" to "Ford-" i.e. only changing where the designatin is "Ford" and not in those that already have a model design...
hi.my query is "SELECT column_name, table_name FROM information_schema.columns"
.but it execute true in sqlserver ,but it dosn't execute true
in Ms Access.i want to get all colums and tables'name from specific
database.thanks.
...
On my website members are tagging photo position on Google maps API. Longitude and latitude are saved in database (SQL).
Does anyone know how to find tagged photos that are in radius 100km of tagged photo?
Let say that latitude and longitude are 46.03765154061627 | 14.5404052734375. Is there any kind of math formula that would check 1...
This is on Teradata specifically, but in general, is it possible for a macro to accept a list as a parameter? E.g.,
create macro myMacro ( incomingList ) AS
(
select foo
from tBar
where animal in (:incomingList );
);
...and then...
exec myMacro( ('chicken','pig','cow') );
...
I work with people who have historically used Excel and e-mail to 'gather' data from their external contacts. The cells these contacts populate are linked to complicated equations (occasionally macros), or are part of a large cascading cell relationship.
All the data we gather produces multiple outcomes, but all of it requires additio...
Hi All,
I need to retrieve this result:
ROW1.id | ROW2.id | ROW3.id | ROW4.id
1 | 2 | 3 | 4
starting from this result select * from Table:
id | value
1 | sample1
2 | sample2
3 | sample3
4 | sample4
any idea?
thanks,
Andrea
...
In MS Access, my table is:Exam{id,name}, and my query is
select Exam.id as 'Exam.id',Exam.name as 'Exam.name' from Exam
Now when I execute this query this error ocured:
"Exam.id" is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
I want to use the full table +...
I have two columns that are minimum price and maximum price. Most of the time, the min_price and max_price is the same. Instead of two separate fields for the price, I would like just one "price" field. If the min_price and the max_price are the same I want to display that price. If the min_price and max_price are different, then I w...
I have a SqlDataSource that calls a stored proc. When the page loads a Gridview loads that uses that SqlDataSource.
At this time I want to be able to debug the stored proc.
I DON'T want to debug the stored proc on it's own.
I want to see what values are actually being passed to the stored proc and what it is actually doing.
...
Hey Guys,
I am working on something where i have a table C with two columns Ndc and Price. All i care about the price field. it shows invalid values like 0, Null, negative. there is a left join between two tables A and B and i am getting table C from that. so Ndc values are matching and unmatching from both the tables but for that value...
I have a model which contains a java.util.Set object as a member. How do I persist this using JDO? Specifically, how do I define the XML in the .jdo file?
class MyClass {
Set<String> data;
private MyClass() {
}
}
...
Hi,
I have a table:
A B c
a1 1 a11
a1 2 a12
a1 3 a13
a2 1 a21
a2 2 a22
a2 3 a23
and I want to convert it to:
A C1 C2 C3
a1 a11 a12 a13
a2 a21 a22 a23
How can I write a SQL query to achieve this... I do not want to convert my table to csv and use python and d...
I'm having trouble on how to code this. First I need to assign a value for every item in the list (1 for the first item, 2 for the 2nd and so on). Does this control have a separate field for the value aside from text?
Second, I need to insert this into my database(MSSQL 2008) in this format:
insert into table values(ID,selectedvaluegoe...
I have a stored procedure as follows
create procedure [dbo].[PriceConfirm]
@quote float,
@membershipType int,
@promocode nvarchar(20),
@giftCertificateCode nvarchar(20)
as
if(LEN(@giftCertificateCode)>1)
begin
declare @giftType int
select @giftType = MembershipType from GiftCertificate where GiftCertificateCode=@giftCertificat...