|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Wednesday, May 25, 2011 4:46 AM
Points: 409,
Visits: 17
|
|
Not all versions of oracle support timestamps/datetime with .999999 fractions of a second . Only Oracle 10G and may be 9i ..The older versions do not even have fractions of a second..
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
You are correct Salim. Yes, timestamp is introduced into Oracle since Oracle 9i. Maybe I should have mentioned that in my article.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, November 19, 2008 12:57 PM
Points: 2,
Visits: 8
|
|
IN MS SQL the timestamp datatype is used as a mechanism for version-stamping table rows. Do we have the same mechanism in ORACLE? Thanks
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 5:25 PM
Points: 15,
Visits: 160
|
|
Nice article, right to the point. I have a question (since this is "Part 1") regarding Part 2. Do you know of any way to pass in variables through the OpenQuery statement? There are many times that you want to filter the returnset on the Oracle side. Thanks
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 23, 2009 9:44 AM
Points: 179,
Visits: 22
|
|
There's the strategy of building the string to pass through. If there's a better way I'd sure love to know. Counting tick marks gets old.
DECLARE @UID char(9), @Query varchar(5000) Set @UID = '123456789'
Set @Query = 'SELECT * FROM OPENQUERY(LINKED_SERVER,''SELECT * FROM TABLE_NAME WHERE UID = ''''' + @EID + ''''''')' exec(@Query)
Everett Wilson ewilson10@yahoo.com
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 5:25 PM
Points: 15,
Visits: 160
|
|
Thanks for the suggestion. We have tried that and although it works, the limitations of Dynamic SQL don't fit well with the rest of our needs. The return from our query needs to be inserted into a local Table variable. Dynamic SQL can only access this table if I declare it as a standing table or a global temporary table (##)...neither option will work for this solution. We chose to use a Table variable so each time the SP executes it maintains the table within its own scope.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Sunday, September 16, 2012 3:26 AM
Points: 1,038,
Visits: 443
|
|
You could use sp_executesql which at least cleans things up a bit with the quote counting.. Also, you can insert into a table variable from an exec statement - so the dynamic SQL is not out of the question for you. It is rather annoying that openQuery doesn't take variables as inputs - anyone know why it's designed that way? Is it to allow SQL Server Optimiser to know about the statement it will be sending?
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, January 11, 2012 1:51 AM
Points: 73,
Visits: 174
|
|
There's another subtle difference about varchars. The maximum field width is 4000 as you mentioned, but the declaration of a varchar variable in PL/SQL can be as large as 32767 (32Kb - 1). Cheers, Win
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 5:25 PM
Points: 15,
Visits: 160
|
|
Follow-up question for Ian Yates' post. I have been operating under the belief that you cannot "insert into a table variable from an exec statement." If that is possible I believe that would solve our problems. Could you give an example of the syntax? Thanks.
|
|
|
|