Tag: oracle

Bind variable options

Is it possible to denote a bind variable in SQL Server using the same notation as Oracle i.e. :0, :1 instead of using ?. I have searched but not found anything conclusive on this. At the moment my solution uses bind variables to introduce values to statements that I run on the database which works […]

Merge two sql queries with if condition

I want to merge two queries. I have Query1 returning some Ids. Then I have Query2 which firstly check if some Ids are present in table. If no then the result would be Ids returned by Query1. If yes then I want common Ids which are returned by Query1 and Query2 like intersect of Ids […]

Database design: Where to store account balance?

Possible Duplicate: Database design: Calculating the Account Balance should the user's Account balance be stored in the database or calculated dynamically? Where is the best place to store the user’s account balance and why? 1) “Transaction” table, as calculated at the time when the transaction occurred or 2) “Account” Table, updated every time the user […]

Alternate for select <sequence>.nextval from dual of Oracle in SQL Server?

Is there any way to create a unique sequence no in SQL Server select <sequence>.nextval from dual We have the above code for Oracle which will create a unique number and the number cannot be used by any other. In the same way how can I create a unique sequence number in SQL Server???? Some […]

“ORA-00936: missing expression” Linked query to Oracle using OpenQuery

I am trying to execute the following query: SELECT * FROM OPENQUERY ( CLP, ‘ SELECT * FROM ORACLE_TABLE WHERE [UPDATEDATE] > ”1900-01-01 12:00 AM” ‘ ) This query works fine when I remove the date criteria. But as soon as I try to pass this criteria it no longer works. I can’t figure out […]

SQL JOINING 5 tables due to a criteria

I have 5 tables in MySQL, but i believe this is a SQL problem USERS USER_INFO USER_RIGHTS 101 = read right 102 = write right GROUPS POSTS Now i want to select for user 2 for example, all posts made by any user where user 2 has the read right 101 in that group For […]

passing cursor variable into a query

I am an Oracle developer trying to learn T-SQL. I have a table with one column in it (table_name). I need to be able to loop over all rows and find all columns for a given table. Then I need to output the result of it to the file. In Oracle it is pretty simple […]

Update variable for each row in a SELECT in Oracle

I am normally working with MS SQL. I have a piece of code which I might have to translate to Oracle SQL. In this piece of code I update two variables for each row in order to find the max value of concurrent users. My question is if it is possible to do the same […]

How to execute remote query by Oracle Database Link

I use Oracle Database Link to query data from SQL Server. The query is like: select * from tableA@DL_SqlServer a join tableB@DL_SqlServer b on a.ID = b.ID tableA and tableB is large and the result is relatively small. This query executes quickly in SQL Server since indexes are built both on the two tables. But […]

How to Query Remote Database with Huge Where Clause from Local Database

I am populating a table in a local database (localdb, SQL Server) with data pulled from a remote database (remotedb, Oracle). The remote database is across the internets, and of course, local database is local to my db server. I need to pull data from remotedb, and in order to pull the data from remotedb, […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.