Showing posts with label straight. Show all posts
Showing posts with label straight. Show all posts

Monday, March 26, 2012

Feedback wanted: Simulating @@Identitt behavior

Traditionally, implementing an alternative for the MS SQL Server
IDENTITY in Oracle is pretty straight forward:
e.g:
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
END;
/
So far so good.
However, in my case I am dealing with a large application which is
running 'mixed', eg, originally designed for MS SQL Sever, and now
being adapted to run under Oracle as well. As the @.@.Identity is wildly
used, I thought of an alternative for returning the last identiry
value. As the queries themselves are already parsed, replacing all
occurrences of @.@.Identity with something else is a breeze.
So, my idea is to implement a global identity value with a package.
Can anybody tell me if the following is a good or a bad plan, and if
there are any caveats?
Thanks
Code:
CREATE OR REPLACE PACKAGE SomePackageName
IS
FUNCTION GetIdentity RETURN NUMBER;
PROCEDURE SetIdentity(Identity IN NUMBER);
END SomePackageName;
/
CREATE OR REPLACE PACKAGE BODY SomePackageName
IS
Identity NUMBER(10) := NULL;
FUNCTION GetIdentity
RETURN NUMBER
IS
BEGIN
RETURN Identity;
END;
PROCEDURE SetIdentity(Identity IN NUMBER)
IS
BEGIN
SomePackageName.Identity := Identity;
END;
END SomePackageName;
/
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
SomePackageName.SetIdentity(:new.ID);
END;
/
Application example:
SET SERVEROUTPUT ON;
DECLARE
NewID NUMBER(10);
BEGIN
INSERT INTO MyTable(Description) VALUES('Hello world');
NewID := SomePackageName.GetIdentity;
dbms_output.put_line('New ID = ' || TO_CHAR(NewID));
END;
/
Hmmm, actually, I'd better post this in the Oracle groups. Sorry for
spamming Oracle stuff here.

Feedback wanted: Simulating @@Identitt behavior

Traditionally, implementing an alternative for the MS SQL Server
IDENTITY in Oracle is pretty straight forward:
e.g:
---
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
END;
/
---
So far so good.
However, in my case I am dealing with a large application which is
running 'mixed', eg, originally designed for MS SQL Sever, and now
being adapted to run under Oracle as well. As the @.@.Identity is wildly
used, I thought of an alternative for returning the last identiry
value. As the queries themselves are already parsed, replacing all
occurrences of @.@.Identity with something else is a breeze.
So, my idea is to implement a global identity value with a package.
Can anybody tell me if the following is a good or a bad plan, and if
there are any caveats?
Thanks
Code:
---
CREATE OR REPLACE PACKAGE SomePackageName
IS
FUNCTION GetIdentity RETURN NUMBER;
PROCEDURE SetIdentity(Identity IN NUMBER);
END SomePackageName;
/
CREATE OR REPLACE PACKAGE BODY SomePackageName
IS
Identity NUMBER(10) := NULL;
FUNCTION GetIdentity
RETURN NUMBER
IS
BEGIN
RETURN Identity;
END;
PROCEDURE SetIdentity(Identity IN NUMBER)
IS
BEGIN
SomePackageName.Identity := Identity;
END;
END SomePackageName;
/
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
SomePackageName.SetIdentity(:new.ID);
END;
/
Application example:
---
SET SERVEROUTPUT ON;
DECLARE
NewID NUMBER(10);
BEGIN
INSERT INTO MyTable(Description) VALUES('Hello world');
NewID := SomePackageName.GetIdentity;
dbms_output.put_line('New ID = ' || TO_CHAR(NewID));
END;
/Hmmm, actually, I'd better post this in the Oracle groups. Sorry for
spamming Oracle stuff here.

Feedback wanted: Simulating @@Identitt behavior

Traditionally, implementing an alternative for the MS SQL Server
IDENTITY in Oracle is pretty straight forward:
e.g:
---
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
END;
/
---
So far so good.
However, in my case I am dealing with a large application which is
running 'mixed', eg, originally designed for MS SQL Sever, and now
being adapted to run under Oracle as well. As the @.@.Identity is wildly
used, I thought of an alternative for returning the last identiry
value. As the queries themselves are already parsed, replacing all
occurrences of @.@.Identity with something else is a breeze.
So, my idea is to implement a global identity value with a package.
Can anybody tell me if the following is a good or a bad plan, and if
there are any caveats?
Thanks
Code:
---
CREATE OR REPLACE PACKAGE SomePackageName
IS
FUNCTION GetIdentity RETURN NUMBER;
PROCEDURE SetIdentity(Identity IN NUMBER);
END SomePackageName;
/
CREATE OR REPLACE PACKAGE BODY SomePackageName
IS
Identity NUMBER(10) := NULL;
FUNCTION GetIdentity
RETURN NUMBER
IS
BEGIN
RETURN Identity;
END;
PROCEDURE SetIdentity(Identity IN NUMBER)
IS
BEGIN
SomePackageName.Identity := Identity;
END;
END SomePackageName;
/
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
SomePackageName.SetIdentity(:new.ID);
END;
/
Application example:
---
SET SERVEROUTPUT ON;
DECLARE
NewID NUMBER(10);
BEGIN
INSERT INTO MyTable(Description) VALUES('Hello world');
NewID := SomePackageName.GetIdentity;
dbms_output.put_line('New ID = ' || TO_CHAR(NewID));
END;
/Hmmm, actually, I'd better post this in the Oracle groups. Sorry for
spamming Oracle stuff here. :)sql

Friday, February 24, 2012

Failure to install - XOLEHLP.dll not found

Hello,

I'm trying to install CTP3 of katmai on Windows Server 2004 running inside Virtual PC.

It installs the setup files OK. Straight after that I get an error message box saying "The application has failed to start because XOLEHLP.DLL was not found. Re-installing the application may fix this problem"

Clicking OK gives me another message box with the message "TITLE: Microsoft SQL Server code name Katmai Setup

Failed to load SqlSpars.dll

For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&ProdVer=10.0.1019.17&EvtSrc=setup.rll&EvtID=50005&EvtType=setup%5csqlsetupactions.cpp%40InvokeSqlSetupDllAction%40sqls%3a%3aInvokeSqlSetupDllAction%3a%3aperform%400x57


BUTTONS:

OK

"

The link doesn't give me anything useful.

Then I get the familiar 'Send Error Report' dialog. I DID send the error report.

I'm stumped. Anyone got any ideas?

Thanks

Jamie

Moving over to the new Katmai forums|||Jamie,

I assume you tried to instell it on a Win 2003 box (not 2004) :-)

Anyway, that box (or rather VM in your case), how was it created in the first place? Have you done any funky stuff with MSDTC, as xolehlp.dll is a helper file for the DTC. Also, the Katmai installation, was it from the iso or a "normal" installation?

Niels
|||

Hey there Niels,

You're right. Win2k3. DOH!!!

Interesting your comments about DTC - I'll have a play around with that. I certainly haven't done any changes on the box - its as vanilla as it gets. Standard OS install. I'm using the katmai executable - i.e. not the .iso

This is all at home and I am now at work. I'll have another play around later this evening.

Thanks

Jamie

|||OK, try the ISO and see if it helps.

Niels

Failure to install - XOLEHLP.dll not found

Hello,

I'm trying to install CTP3 of katmai on Windows Server 2004 running inside Virtual PC.

It installs the setup files OK. Straight after that I get an error message box saying "The application has failed to start because XOLEHLP.DLL was not found. Re-installing the application may fix this problem"

Clicking OK gives me another message box with the message "TITLE: Microsoft SQL Server code name Katmai Setup

Failed to load SqlSpars.dll

For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&ProdVer=10.0.1019.17&EvtSrc=setup.rll&EvtID=50005&EvtType=setup%5csqlsetupactions.cpp%40InvokeSqlSetupDllAction%40sqls%3a%3aInvokeSqlSetupDllAction%3a%3aperform%400x57


BUTTONS:

OK

"

The link doesn't give me anything useful.

Then I get the familiar 'Send Error Report' dialog. I DID send the error report.

I'm stumped. Anyone got any ideas?

Thanks

Jamie

Moving over to the new Katmai forums|||Jamie,

I assume you tried to instell it on a Win 2003 box (not 2004) :-)

Anyway, that box (or rather VM in your case), how was it created in the first place? Have you done any funky stuff with MSDTC, as xolehlp.dll is a helper file for the DTC. Also, the Katmai installation, was it from the iso or a "normal" installation?

Niels
|||

Hey there Niels,

You're right. Win2k3. DOH!!!

Interesting your comments about DTC - I'll have a play around with that. I certainly haven't done any changes on the box - its as vanilla as it gets. Standard OS install. I'm using the katmai executable - i.e. not the .iso

This is all at home and I am now at work. I'll have another play around later this evening.

Thanks

Jamie

|||OK, try the ISO and see if it helps.

Niels

Sunday, February 19, 2012

Failure sending mail: The system cannot find the path specified.

I have had a development XP workstation with RS2000 and IIS sending reports via email for 6 months straight with no problems.

Today my subscriptions are failing with

Failure sending mail: The system cannot find the path specified.

Been searching and digging for hours, and if anyone has any ideas they are greatly appreciated.

I need some info to troubleshoot...

Replicate the issue, then go the Report Server log (ReportServer_xxx_xxx.log) and email the log to me for review. markcam80@.hotmail.com

What I will be looking for is explicit error messages versus the displayed message.

|||Thanks for the help but it seems we had a domain controller misbehaving.