oracle sql程序会在网格中给出结果

时间:2017-04-20 00:55:19

标签: sql oracle stored-procedures

我正在尝试创建一个程序,以网格形式给我结果(如果可能的话)。

实际上,这是一个普通的查询,有3-5个参数,但我想在一个程序中进行(我将把它用于我正在制作的程序)

我知道如何创建简单的程序,但那些只给我一行输出。 像这样的东西:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
 

<section id ="actus">

  <div class="container">
    <div class="row">
      <div class="section_title">
        <h1>Actus</h1>
        <hr class="divider_blue">
      </div>
    </div>
    <div class="row all_actus">
      <div class="col-md-4">
        <h2>LOREM</h2>
      </div>

      <a href="#">
        <div class="col-md-8 button_all_actus">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a> 

      <a href="#">
        <div class="col-md-4 col-md-offset-4 button_actus_size_2">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a>

      <a href="#">
        <div class="col-md-4 col-md-offset button_actus_size_2">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a>
      <a href="#">
        <div class="col-md-4 col-md-offset-4 button_actus_size_2">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a>

      <a href="#">
        <div class="col-md-4  button_actus_size_2">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a>

      <a href="#">
        <div class="col-md-8 col-md-offset-4 button_actus_size_3">
          <p class="text-left">LOREM</p>
          <p class="text-right"> &#8594; </p>
        </div>
      </a>
    </div>
  </div> 
</section>

<section id="temoignages">
  <div class="container">
    <div class="row">
      <div class="section_title">
        <h1>Lorem</h1>
        <hr class="divider_blue">
      </div>
    </div>

    <div class="row">
      <div class="col-md-7">
        <p>Lorem ipsum</p>
      </div>

      <div class="col-md-3 col-md-offset-2 alignright">
        <img src="https://dummyimage.com/242x242/000/fff">
      </div>
    </div>
  </div>
</section>

2 个答案:

答案 0 :(得分:1)

- 将光标作为输出参数返回的简单过程

input = 1500.000001
output = 1500

input = 1500.01
output = 1500.01

input = 1500
output = 1500

答案 1 :(得分:1)

在Oracle 12c中,可以使用DBMS_SQL.RETURN_RESULT

来实现
create or replace procedure get_data
  c1 SYS_REFCURSOR;  
  c2 SYS_REFCURSOR;  
BEGIN
  OPEN c1 FOR 
  select 'First result' as what, 1 as some_number from dual;
  DBMS_SQL.RETURN_RESULT(c1);

  OPEN c2 FOR 
  select 'Second result' as what, 2 as second_column, 3 as third_column 
  from dual;
  DBMS_SQL.RETURN_RESULT(c2);

END;
/ 

然后运行它:

exec get_data;

例如SQL * Plus将显示:

SQL> exec get_data;

PL/SQL procedure successfully completed.

ResultSet #1

WHAT         SOME_NUMBER
------------ -----------
First result           1

1 row selected.

ResultSet #2

WHAT          SECOND_COLUMN THIRD_COLUMN
------------- ------------- ------------
Second result             2            3

1 row selected.

SQL>

其他SQL客户端可能以不同的方式显示结果。