标签: temp-tables

Oracle 10中的本地临时表(针对存储过程的范围)

我是oracle的新手.我需要在存储过程中处理大量数据.我正在考虑使用临时表.我正在使用连接池,应用程序是多线程的.

有没有办法以每次调用存储过程创建不同表实例的方式创建临时表,以便来自多个存储过程调用的数据不会混淆?

sql database oracle stored-procedures temp-tables

1
推荐指数
1
解决办法
3万
查看次数

如何在多个c#调用中使用临时表

我有一个C#应用程序,使用ADO.Net连接到MSSQL

我需要创建表(具有动态列数),然后插入许多记录,然后从表中选择退出.

每个步骤必须是一个单独的C#调用,尽管我可以在一段时间内保持连接/事务处于打开状态.

c# sql temp-tables

1
推荐指数
2
解决办法
8077
查看次数

SQL Server中派生表的范围

我最近一直在研究SQL并进行一些探索.关于临时表我发现了3种不同的临时表类型:

1)CREATE TABLE #TempTable

2)DECLARE TABLE @TempTable

3)SELECT*FROM(SELECT*FROM Customers)AS TempTable

现在我理解了#TempTable和@TempTable类型背后的范围,但是如例3中的派生表呢?这个派生表存储在哪里?如果它在1个事务中声明,第二个事务是否可以访问它,或者是与示例1和2相同的派生表的范围?

sql sql-server temp-tables scoping

1
推荐指数
1
解决办法
3016
查看次数

字符串或二进制数据将被截断

消息8152,级别16,状态14,行60字符串或二进制数据将被截断.

我想插入临时表.这个程序一直在通过测试,直到昨天.我得到截断错误,修复了一个字段,它开始工作.今天我运行它,我再次得到截断错误.我尝试将插入中的所有字段设置为等于max和8000但无效.是否对临时表有某种数据限制限制.我对输入的所有最大长度进行了评估,并且所有这些都在表格构造的限制范围内.

Temp Table非常大,但在我看来是必要的.

sql sql-server temp-tables

1
推荐指数
1
解决办法
1万
查看次数

检查是否存在临时表

如何检查Oracle临时表是否存在?当我知道它存在时,我在查询ALL_TABLES或USER_TABLES时看不到该表.

另外,为了确保我理解临时表,如果使用ON COMMIT DELETE ROWS创建,表将始终存在,但会话结束时数据将被删除?会话是指连接何时关闭?

oracle temp-tables oracle11g

1
推荐指数
1
解决办法
2万
查看次数

在Oracle SQL中构造临时表

我正在尝试创建一个"存储"两个值之间的解码的子表,因为我需要多次使用该解码.让我们说这些是我的表:

Table Person
Name    Number_name
Jeremy  One
Thomas  Two
Stephen Three
Run Code Online (Sandbox Code Playgroud)

我当前的SQL看起来像这样:

SELECT
    decode (number_name,
    'one',1,
    'two',2,
    'three',3,
    'four',4)
    num
    FROM person where name = 'Jeremy'
    and (some other condition)
UNION SELECT
    decode (number_name,
    'one',1,
    'two',2,
    'three',3,
    'four,4)
    num
    FROM Person
    where Name <> "Jeremy"
    and (some other condition)
Run Code Online (Sandbox Code Playgroud)

我希望能做的是这样的:

SELECT num from my_temp_table where name = "Jeremy" and (some other condition)
union select num from my_temp_table where name <> "Jeremy" and (some other condition)
...
Run Code Online (Sandbox Code Playgroud)

其中my_temp_table是在该查询期间构造的(它在查询完成运行时不再存在)并且看起来像

Table my_temp_table
Name …
Run Code Online (Sandbox Code Playgroud)

sql oracle temp-tables

1
推荐指数
1
解决办法
6820
查看次数

MySql:如何使用动态select语句创建临时表?

正如您可以从标题中理解的那样,我想通过使用动态select语句来创建临时表.这是我的代码:

 declare  strwhere varchar(30);
if hour(now()) >= 16 and minute(now()) >=30 then
    set strwhere = ' day(now()) +1 ';
else 
    set strwhere = '  day(now()) ';
end if;
set @query = concat("select  pc.customerid,
                    deliverytimespanid,
                    pc.id,
                    ca.districtid,
                    pc.status,
                    pc.orderid,
                    deliverydatetime
                from packages as pc
                inner join  customeraddresses as ca on ca.id = pc.addressid
                where pc.status = 1
                and day(pc.deliverydatetime) =",strwhere,"
                and month(pc.deliverydatetime) = month(now()) 
                and year(pc.deliverydatetime) = year(now()) ");

prepare resultset from @query;
execute resultset;
deallocate prepare resultset;
create temporary table …
Run Code Online (Sandbox Code Playgroud)

mysql sql stored-procedures temp-tables

1
推荐指数
1
解决办法
3923
查看次数

SQL Server使用嵌套循环,因为估计的行数很差

我使用SQL Server 2008 R2.我创建了一个临时表,然后用1000行填充临时表.

Create Table #Temp
(
  ID Int,
  res INT
)

Insert Into #Temp 
VALUES (10004, 2246), (10005, 2246), (10006, 2246), (10007, 2246),
       (10008, 2246), (10009, 2246), (10010, 2246), (10011, 2246),
       (10013, 2246), (10014, 2246), (10015, 2246), (10016, 2246),
       (10017, 2246), (10018, 2246), (10019, 2246), (10020, 2246),
       (10021, 2246), ................ 
Run Code Online (Sandbox Code Playgroud)

我有另一个名为的表Item.它有大约30000条记录.

我有一个INNER JOIN介于Item我和临时表之间.

Select 
    * 
From 
    Inventory.Item 
Inner Join
    #Temp On (#Temp.ID = item.MasterID And MRes = ExRestaurantID)
Run Code Online (Sandbox Code Playgroud)

正如您在下面的三张图片中看到的,SQL Server已经为我的查询创建了一个执行计划,但在他的计划中,它估计我的Item表只有一行,因此它使用了嵌套循环连接. …

sql-server temp-tables nested-loops sql-server-2008-r2 sql-execution-plan

1
推荐指数
1
解决办法
461
查看次数

无法添加字段...行大小...大于允许的最大大小

我在MySQL日志中看到以下错误:

[Warning] InnoDB: Cannot add field `wd_field_ft_95_240` in table `tmp`.`#sql_1_0` because after adding it, the row size is 8155 which is greater than maximum allowed size (8126) for a record on index leaf page.

这个tmp数据库是某种内部MySQL结构吗?这是我需要关心的事吗?

mysql innodb temp-tables

1
推荐指数
1
解决办法
5137
查看次数

如何在postgresql中使用值和空列创建临时表

我对postgresql很新.我想创建一个包含一些值和空列的临时表.这是我的查询,但它没有执行,但在,(逗号)给出错误.

CREATE TEMP TABLE temp1 
AS (
 SELECT distinct region_name, country_name 
 from opens 
 where track_id=42, count int)
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

如何使用选择查询和其他列为空的某些列创建临时表?

sql postgresql temp-tables

1
推荐指数
1
解决办法
6346
查看次数