1. 程式人生 > 其它 >HANA ABAP select 內表 查詢

HANA ABAP select 內表 查詢

技術標籤:abap語法abap

把查詢好的內表作為資料庫表再次查詢

DATA:BEGIN OF LS_DISP,
      NAME TYPE CHAR10,
     END OF LS_DISP.
DATA:LT_DISP LIKE TABLE OF LS_DISP.
DATA:GV_NAME TYPE CHAR10.
 PARAMETERS P_NAME TYPE CHAR10.

 LS_DISP-NAME = '清華'.
  APPEND LS_DISP TO LT_DISP.
 LS_DISP-NAME = '北京理工'.
  APPEND LS_DISP TO LT_DISP.
 LS_DISP-NAME = '杭州電子科技'.
  APPEND LS_DISP TO LT_DISP.
 LS_DISP-NAME = '北京'.
  APPEND LS_DISP TO LT_DISP.
 LS_DISP-NAME = '武漢'.
 APPEND LS_DISP TO LT_DISP.

 P_NAME = '%' && P_NAME  &&'%'.
  SELECT
    NAME
   FROM @LT_DISP AS A
   WHERE NAME LIKE @P_NAME
   INTO @GV_NAME.
  ENDSELECT.

 WRITE : GV_NAME.