我想在a中应用以下条件select query.
IF (TYPE = MBUSA or SDSA or MDSA OR PC) and (FINAL_STATUS = ACTIVE OR EXECUTED)
then GET ID and Parent_ID
ELSEIF (TYPE = MSA) and (FINAL_STATUS = ACTIVE OR EXECUTED)
then GET ID---(USING the ID from the else if condition AS FILTER,
IF TYPE = (DSA OR BUSA) AND (FINAL_STATUS = ACTIVE OR EXECUTED)
then GET ID and Parent_ID)
Run Code Online (Sandbox Code Playgroud)
我需要写一个程序吗?
以下是数据库结构:

我在oracle中创建了包,并定义了类型如下
TYPE type_<xxx> IS TABLE OF <table>.value%TYPE INDEX BY pls_integer;
Run Code Online (Sandbox Code Playgroud)
现在我将.NET连接到oracle并从包中调用一些方法,其中一个参数是type_type.一切正常
但我在包下面的脚本上有另一种方法
distinctNewValues := pperiods MULTISET except curweekdayarray;
Run Code Online (Sandbox Code Playgroud)
在那里distinctNewValues,pperiods 并且curweekdayarray是type_<xxx> 类型
编译包时会出错
distinctNewValues := pperiods MULTISET except curweekdayarray;
Run Code Online (Sandbox Code Playgroud)
错误详情:
line.
error:Compilation errors for PACKAGE BODY <schema>.<pkg_name>
Error: PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
Line: 163
Text: distinctNewValues := pperiods MULTISET except curweekdayarray;
Error: PL/SQL: Statement ignored
Line: 163
Text: distinctNewValues := pperiods MULTISET except curweekdayarray;
Run Code Online (Sandbox Code Playgroud)
我可以定义没有pls_integer索引的类型.但.NET …
表名: T_record
Id(auto increment using sequence) Name Age
1 Chitta 18
2 Chitta1 19
3 Chitta2 18
4 Chitta3 18
Run Code Online (Sandbox Code Playgroud)
我有PL/SQL程序,它将在上表中插入记录.
Insert into T_record (name, Age)
(select name, age
from T_record
where Age =18)
returning id bulk collect into v_newly_added_conf_input_ids;
Run Code Online (Sandbox Code Playgroud)
但批量收集不起作用.
我怎样才能知道id新插入的s(我希望它id在其他选择查询中使用相同的s)?
我有一个SQL过程,应该执行FOR-IN(SELECT ..)循环,其中SELECT内容应根据一些输入参数而变化.我的想法是将SELECT字符串存储到一个变量中,然后尝试在FOR-IN循环中提取变量值但到目前为止没有成功(之前有一个修复的SELECT语句,那就是我现在要替换的内容) ).代码如下所示
PROCEDURE run(p_boolean BOOLEAN)
IS
BEGIN
DECLARE
v_mystring VARCHAR(50);
BEGIN
IF p_boolean = TRUE
THEN
v_mystring := 'SELECT something...';
ELSE
v_mystring := 'SELECT something else...';
END IF;
FOR p_table_name IN (would-like-to-use-the-value-of-v_mystring-here-some-way)
LOOP
...
END LOOP;
END;
END;
Run Code Online (Sandbox Code Playgroud)
在SQL中相当新手,很可能会发生在这里尝试使用字符串变量值的整个概念是错误的.我浏览了一些教程并尝试了其他一些想法(例如光标),但没有结果.任何想法都表示赞赏
我试图使用动态sql(立即执行)显示重复记录.我收到'指定超过30个字符的标识符'错误.我在动态sql上做错了什么?
CREATE OR REPLACE PROCEDURE FIND_DUP(P_TABLE IN VARCHAR2, P_COLUMN IN VARCHAR2)
AS
stmt_txt varchar2(4000);
BEGIN
stmt_txt:= 'select'
||p_column
|| 'from'
||p_table
|| 'group by'
||p_column
||'having count(*)>1';
execute immediate stmt_txt;
end;
/
EXECUTE FIND_DUP('EMPLOYEES','FIRST_NAME');
Run Code Online (Sandbox Code Playgroud) BEGIN
exception
when others then
sqltext2:='insert into ERROR_TABLE_SHREE select '||str||' from dual;';
EXECUTE IMMEDIATE sqltext2;
end;
COMMIT;
Run Code Online (Sandbox Code Playgroud)
我在异常块中得到以下错误
ORA-00911: invalid character
Run Code Online (Sandbox Code Playgroud) 有人可以给我一些关于如何在多个列中获得最小值的建议吗?如果可能的话,我想在不使用子查询的情况下这样做.
提前致谢!
像'最少'的功能.
以下pl/sql程序在行上执行生成错误sum:= temp*sum; 遇到符号; 期待时(.请解释我的错误.
declare
n number;
temp number;
sum number := 1;
begin
n := &n;
temp := n;
while temp>0 loop
sum := temp*sum;
temp := temp-1;
end loop;
dbms_output.put_line('Factorial of '||n||' is '||sum);
end;
/
Run Code Online (Sandbox Code Playgroud) 有一个值列表,我从shell获得输出.该列表每行包含一个"名称",如下所示.它有超过300行,预计会更长.
BeforeArchive_Field
BeforeArchive_Reservoir
BeforeArchive_Well
BeforeArchive_Wellbore
BeforeArchive_WellboreCompletion
BeforeArchive_WellboreContactInterval
ba_organization_part0
ba_organization_part2
Run Code Online (Sandbox Code Playgroud)
我需要将此列表传递给pl/sql过程,以便它可以解析它并操作每个单独的"名称".由于列表的长度,我想到创建一个存储过程,它将此列表作为CLOB参数.
这两个问题是:
这是处理列表的最佳方式(格式)吗?
如果是这样,有没有一种直接解析这个clob的地狱的方法?
我通过pl\sql 回答逐行阅读这个 阅读clob,但是在某些情况下,事情可能会更简单.
我不熟悉这种LOB格式,并希望得到任何帮助.
我有这个Oracle表.出于开发目的,我想在表中生成10,000个不同的值.我怎么能这样做?
CREATE TABLE ERRORLOG(
ERRORID INTEGER NOT NULL,
ERRORCONTENT CLOB NOT NULL,
ERRORDATE TIMESTAMP(6) NOT NULL
)
Run Code Online (Sandbox Code Playgroud)