您好,登錄后才能下訂單哦!
oracle端:
CREATE VIEW "FJMP"."MP_ATTEND_APPLY_ALL_VIEW" ("ATTEND_ID","ATTEND_TYPE","ATTEND_NAME","PERSON_CODE","PERSON_NAME","APPLY_FALG","APPLY_DATE","APPRAISE_LEVEL","APPRAISE_DATE","APPRAISE_FLAG","STR1","STR2","STR3","STR4","APPLY_FALG_NAME")
AS
SELECT A.ATTEND_ID,A.ATTEND_TYPE,A.ATTEND_NAME,A.PERSON_CODE,PERSON_NAME,APPLY_FALG,APPLY_DATE,APPRAISE_LEVEL,TO_CHAR(APPRAISE_DATE,'YYYY-MM-DD') APPRAISE_DATE,APPRAISE_FLAG,
JSON_ARRAY(
JSON_OBJECT(
KEY 'title' VALUE '"申請人"' FORMAT JSON ,
KEY 'content' VALUE '"'||REPLACE(PERSON_NAME,'–','-')||'"' FORMAT JSON)
,
JSON_OBJECT(
KEY 'title' VALUE '"申請時間"' FORMAT JSON,
KEY 'content' VALUE '"'||TO_CHAR(A.APPLY_DATE,'YYYY-MM-DD')||'"' FORMAT JSON)
,
JSON_OBJECT(
KEY 'title' VALUE '"目的地"' FORMAT JSON,
KEY 'content' VALUE '"'||B.DESTIN_ADDR||'"' FORMAT JSON)
,
JSON_OBJECT(
KEY 'title' VALUE '"申請用途"' FORMAT JSON,
KEY 'content' VALUE '"'||B.CONTENT||'"' FORMAT JSON)
) STR1,'' STR2,'' STR3,'' STR4,
--'申請人:'||PERSON_NAME STR1,'申請時間:'||TO_CHAR(A.APPLY_DATE,'YYYY-MM-DD') STR2,'目的地:'||B.DESTIN_ADDR STR3,'文件摘要:'||SUBSTR(B.CONTENT,1,20)||'...' STR4,
DECODE(APPLY_FALG,'0','未審批','1','審批通過','2','審批不通過','3','撤銷') APPLY_FALG_NAME
FROM MP_ATTEND A,MP_ATTEND_APPLY_CAR B
WHERE A.ATTEND_ID=B.ATTEND_ID
達夢端:
CREATE VIEW "FJMP"."MP_ATTEND_APPLY_ALL_VIEW" ("ATTEND_ID","ATTEND_TYPE","ATTEND_NAME","PERSON_CODE","PERSON_NAME","APPLY_FALG","APPLY_DATE","APPRAISE_LEVEL","APPRAISE_DATE","APPRAISE_FLAG","STR1","STR2","STR3","STR4","APPLY_FALG_NAME")
AS
SELECT A.ATTEND_ID,A.ATTEND_TYPE,A.ATTEND_NAME,A.PERSON_CODE,PERSON_NAME,APPLY_FALG,APPLY_DATE,APPRAISE_LEVEL,TO_CHAR(APPRAISE_DATE,'YYYY-MM-DD') APPRAISE_DATE,APPRAISE_FLAG,
'{[
{
"title" : "申請人",
"content" : "'||REPLACE(PERSON_NAME,'–','-')||'" }
,
{
"title" : "申請時間",
"content" : "'||TO_CHAR(A.APPLY_DATE,'YYYY-MM-DD')||'"}
,
{
"title" : "目的地",
"content" : "'||B.DESTIN_ADDR||'"}
,
{
"title" : "申請用途",
"content" : "'||B.CONTENT||'"}]
}'STR1,'' STR2,'' STR3,'' STR4,
--'申請人:'||PERSON_NAME STR1,'申請時間:'||TO_CHAR(A.APPLY_DATE,'YYYY-MM-DD') STR2,'目的地:'||B.DESTIN_ADDR STR3,'文件摘要:'||SUBSTR(B.CONTENT,1,20)||'...' STR4,
DECODE(APPLY_FALG,'0','未審批','1','審批通過','2','審批不通過','3','撤銷') APPLY_FALG_NAME
FROM MP_ATTEND A,MP_ATTEND_APPLY_CAR B
WHERE A.ATTEND_ID=B.ATTEND_ID
注意事項:(達夢)
1.整個json需要單引號包起來;
2.處理函數格式:"'||sysdate||'"
3.對象使用大括號{},數組使用中括號[]
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。