小编red*_*ost的帖子

对象和记录类型之间的区别

我只是好奇了oracle中对象和记录类型之间的区别,更具体地说,在下面的声明之间

create type emp2_oty is object 
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;
Run Code Online (Sandbox Code Playgroud)

type emp2_oty is record
(
 empno  number,
 ename  varchar2(20),
 deptno number
);

create type emp2_nt is table of emp2_oty;
Run Code Online (Sandbox Code Playgroud)

请详细说明.

oracle

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

Oracle嵌套块和异常处理

DECLARE
    string_of_5_chars VARCHAR2(5);
BEGIN
    BEGIN
        string_of_5_chars := 'Steven';
    EXCEPTION
        WHEN value_error THEN
          RAISE no_data_found;
        WHEN no_data_found THEN
          dbms_output.Put_line ('Inner block');
    END;
EXCEPTION
    WHEN no_data_found THEN
      dbms_output.Put_line ('Outer block');
END; 
Run Code Online (Sandbox Code Playgroud)

答案说输出将是"外部块",有人可以解释为什么内部块不会被执行吗?oracle中异常的优先级是什么?

oracle plsql oracle11g

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

从 Oracle 函数返回引用游标

我收到错误 - PLS-00382 表达式类型错误。
我想将参考光标作为输出。请让我知道我该怎么做

create or replace function  test_cur
return sys_refcursor
as
  var_ref sys_refcursor;
begin
  open var_ref for
  select item,status
    from item_master  
   where rownum <10;
  return var_ref;
end;


declare
  l_var sys_refcursor;
  l_item varchar2(100);
  l_status varchar2(10);
begin
  l_var:=test_cur;
  open l_var;
  loop
    fetch l_var into  l_item,l_status;
    exit when l_var%notfound;
    dbms_output.put_line(l_item||','||l_status);
  end loop;
end;
Run Code Online (Sandbox Code Playgroud)

有人可以帮我解决这个问题吗?

oracle plsql ref-cursor

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

C中的数字比较给出了错误的结果

我写了一个程序来检查回文数.

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
    main()
    {
        int n,i;
        printf("Please enter a number: ");
        scanf("%d", &n);
        /* Function Prototypes */
        int reverse(int *p);
        i=reverse(&n);
        printf("Number returned %d",i);
        if (i == n) 
        {
            printf("The number is a palindrome");
        }
        else
        {
            printf("The number is NOT a palindrome");
        }

    }
    int reverse( int *p)
    {
        int rev=0;
        while(*p !=0)
        {
            rev=rev*10;
            rev=rev+ *p%10;
            *p=*p/10;
        }
        return (rev);
    }
Run Code Online (Sandbox Code Playgroud)

但它始终显示"数字不是回文",无论数字是不是回文.

c

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

使用BULK COLLECT向集合分配多个列

我不确定为什么此代码会出现此错误,请帮助我调试此代码。

declare
type emp_t is table of employees%rowtype
index by pls_integer;
rec   emp_t;
begin
  select employee_id,salary,manager_id bulk collect into rec
  from employees where rownum <100;

 forall i in 1..rec.last
    update employees
    set salary=salary+10
    where employee_id=rec(i).employee_id;

end;

ORA-06550: line 7, column 3:
PL/SQL: ORA-00913: too many values
ORA-06550: line 6, column 3:
PL/SQL: SQL Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
Run Code Online (Sandbox Code Playgroud)

我已将代码更改为以下格式,但仍给我“表达式类型错误”

declare 
type emp_t is table of employees%rowtype
index by pls_integer; …
Run Code Online (Sandbox Code Playgroud)

oracle plsql

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

分段错误 - C错误中的字符串连接

我是C编程的新手,仍然试图理解C的所有角落和缝隙.我正在编写一个程序来连接两个字符串.但我收到一个我不明白的错误.这是输出.

Asfakul
字符串名称
的长度为7字符串全名的长度为7
L
分段错误(核心转储)

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int  main(int argc, char const *argv[])
{
  char *name="Asfakul";
  char *surname="Laskar";
  char *fullname;
  int i=0;
  //Allocate Memory of 100 char 
  fullname=(char*)malloc(100*sizeof(char));
  fullname=name;
  while(*name !='\0')
  {
    i++;
    name++;
  }

  // Allocate Memory for FullName

  //fullname=(char*)malloc(100*sizeof(char));
  //Coppied the spurce String
 // fullname=name; // Here this assignement will not work as Pointer name now point to NULL character of String Name.
  puts(fullname);
  printf("The Length of the String name is %d\n",i );
  printf("The Length of …
Run Code Online (Sandbox Code Playgroud)

c

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

标签 统计

oracle ×4

plsql ×3

c ×2

oracle11g ×1

ref-cursor ×1