sql程序将在最后一天打印。

时间:2021-05-25 11:16:07

I am trying to write procedure to print day month

我正试着写程序打印一天的月。

There is no compilation error but its not printing anything.

没有编译错误,但它没有打印任何东西。

3 个解决方案

#1


1  

Try this,

试试这个,

CREATE OR REPLACE PROCEDURE P2 AS 
  to_d date;
BEGIN
  SELECT REP_DATE 
    INTO to_d 
    FROM cmpss_report_calender 
   WHERE REPID='F2';

  IF LAST_DAY(SYSDATE) =LAST_DAY(to_d) 
  THEN
    dbms_output.put_line('');
  ELSE 
    dbms_output.put_line(to_d);
  end if;

END P2;

#2


1  

CREATE OR REPLACE PROCEDURE P2 AS 
  to_d date;
BEGIN
  SELECT REP_DATE 
    INTO to_d 
    FROM cmpss_report_calender 
   WHERE REPID='F2';

  IF LAST_DAY(SYSDATE) =LAST_DAY(to_d) 
  THEN
    dbms_output.put_line('');
  ELSE 
    dbms_output.put_line(to_d);
  end if;

END P2;

If you are using sql plus, do as

如果您使用的是sql plus,那么就这样做。

SET SERVEROUTPUT ON;

EXEC P2;

#3


0  

Try leaving a blank line after the SET SERVEROUTPUT ON command. Also the SET SERVEROUTPUT ON is a SQL Plus command so make sure you are using the same.

尝试在命令的设置服务器输出后留下空白行。另外,设置SERVEROUTPUT是一个SQL +命令,所以确保您使用的是相同的。

#1


1  

Try this,

试试这个,

CREATE OR REPLACE PROCEDURE P2 AS 
  to_d date;
BEGIN
  SELECT REP_DATE 
    INTO to_d 
    FROM cmpss_report_calender 
   WHERE REPID='F2';

  IF LAST_DAY(SYSDATE) =LAST_DAY(to_d) 
  THEN
    dbms_output.put_line('');
  ELSE 
    dbms_output.put_line(to_d);
  end if;

END P2;

#2


1  

CREATE OR REPLACE PROCEDURE P2 AS 
  to_d date;
BEGIN
  SELECT REP_DATE 
    INTO to_d 
    FROM cmpss_report_calender 
   WHERE REPID='F2';

  IF LAST_DAY(SYSDATE) =LAST_DAY(to_d) 
  THEN
    dbms_output.put_line('');
  ELSE 
    dbms_output.put_line(to_d);
  end if;

END P2;

If you are using sql plus, do as

如果您使用的是sql plus,那么就这样做。

SET SERVEROUTPUT ON;

EXEC P2;

#3


0  

Try leaving a blank line after the SET SERVEROUTPUT ON command. Also the SET SERVEROUTPUT ON is a SQL Plus command so make sure you are using the same.

尝试在命令的设置服务器输出后留下空白行。另外,设置SERVEROUTPUT是一个SQL +命令,所以确保您使用的是相同的。