Hi,
Im using Oracle 9i and writing a PL/SQL function and i need to get the sequence.nextval within the function. I am getting an error saying sequence does not exist. I have tryed the following :
select mySeq.nextval
into v_myvar
from dual;
but I still get the same error message. Is there any way to get the next value in a sequence from within a PL/SQL function.
Any help would be greatly appreciated.
ThanksCREATE SEQUENCE myseq;
CREATE OR REPLACE FUNCTION fun_seq
RETURN NUMBER
AS
retval NUMBER;
BEGIN
SELECT myseq.NEXTVAL
INTO retval
FROM DUAL;
RETURN (retval);
END;
/
SELECT fun_seq FROM DUAL;
FUN_SEQ
---
1|||Hi,
Thanks. I dont need to create a sequence because the sequence that I am using (mySeq) already exists on the database.
Thanks|||Figured it out. It was a permissions issue.
Showing posts with label saying. Show all posts
Showing posts with label saying. Show all posts
Monday, March 19, 2012
Monday, March 12, 2012
how do I force connections to close before detaching a DB
Hi,
I need to detach a DB, but need to force any current connections to be
disconnected as I am getting an error saying that I cannot detach the DB as
it is being used.
What is the best way of doing this?
I am using DMO to detach at the moment.
ThanksALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
(Why are you detaching the database? Why are you detaching a database that
is in use?)
"Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
news:OTM174ZkFHA.1948@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to detach a DB, but need to force any current connections to be
> disconnected as I am getting an error saying that I cannot detach the DB
> as it is being used.
> What is the best way of doing this?
> I am using DMO to detach at the moment.
> Thanks
>
I need to detach a DB, but need to force any current connections to be
disconnected as I am getting an error saying that I cannot detach the DB as
it is being used.
What is the best way of doing this?
I am using DMO to detach at the moment.
ThanksALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
(Why are you detaching the database? Why are you detaching a database that
is in use?)
"Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
news:OTM174ZkFHA.1948@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to detach a DB, but need to force any current connections to be
> disconnected as I am getting an error saying that I cannot detach the DB
> as it is being used.
> What is the best way of doing this?
> I am using DMO to detach at the moment.
> Thanks
>
Friday, March 9, 2012
How do I find out what caused a deadlock?
I got an error message from my customer saying that once, during the night,
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
Bob
Here is a start
http://support.microsoft.com/default...b;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegr oups.com...
> Here is a start
> http://support.microsoft.com/default...b;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
Bob
Here is a start
http://support.microsoft.com/default...b;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegr oups.com...
> Here is a start
> http://support.microsoft.com/default...b;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
How do I find out what caused a deadlock?
I got an error message from my customer saying that once, during the night,
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
BobHere is a start
http://support.microsoft.com/default.aspx?scid=kb;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegroups.com...
> Here is a start
> http://support.microsoft.com/default.aspx?scid=kb;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
BobHere is a start
http://support.microsoft.com/default.aspx?scid=kb;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegroups.com...
> Here is a start
> http://support.microsoft.com/default.aspx?scid=kb;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
How do I find out what caused a deadlock?
I got an error message from my customer saying that once, during the night,
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
BobHere is a start
http://support.microsoft.com/defaul...kb;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegroups.com...
> Here is a start
> http://support.microsoft.com/defaul...kb;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
when executing a report it got an error message that stopped the application
the extended error was
Transaction (Process ID 57) was deadlocked on lock resources with another
process and has been chosen as the deadlock victim. Rerun the transaction.
Thats fine but It was an untrapped error that required a stop and start of
the application and its the first time it occured in seven years of running
this app. The app is a report, so everyting is read-only, there are no
record editing or creations involved, so how can it create a deadlock?
To answer these questions I think I need to know what the conditions were
that created the deadlock, I think that may be possible looking through the
transaction log of sql server, but how do I do that? When I looked under
administration logs in the sql server explorer all I saw was basically the
logs of the backups , but no place where I could find what transact sql
statement executed at what time with what results. Is there a way to find
this out or is that info lost after commandes execute?
Thanks for your help,
BobHere is a start
http://support.microsoft.com/defaul...kb;en-us;832524
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thanks Denis
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1144345622.731620.232190@.v46g2000cwv.googlegroups.com...
> Here is a start
> http://support.microsoft.com/defaul...kb;en-us;832524
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
Subscribe to:
Posts (Atom)