2013-11-26 5 views
2

SQL 요청을 사용하여 JIRA에서 문제를 검색하고 있습니다. 지금까지 담당자 이름이나 리포터에 따라 선택한 문제 수를 검색 할 수 있습니다. 작성 필드 (이슈가 작성된 날짜) 또는 사용자 정의 필드에 따라 문제점을 검색 할 수 없어서 문제점이 발생하여 오류가 발생합니다. 인식 할 수없는 필드! 내 접근 방식은 코드의이 부분에 놀러이었다jira에서 문제 가져 오기

**lv_json_request := '{' 
              ||'"jql": "assignee='||:P9_ASSIGNEE||'",' 
              ||'"startAt": '||NVL(:P9_STARTAT,0)||',' 
              ||'"maxResults": '||:P9_MAXRESULTS 
              ||'}';** 

당신은 전체 PL/SQL 블록을 검색 할 수 있습니다, 그것은 현재의 상황에 잘 작동합니다.

DECLARE 
    http_req utl_http.req; 
    http_resp utl_http.resp;  
    lv_json_request VARCHAR2(32767); 
    lc_response CLOB; 
    lv_response VARCHAR2(32767); 
BEGIN 
    lv_json_request := '{' 
              ||'"jql": "assignee='||:P9_ASSIGNEE||'",' 
              ||'"startAt": '||NVL(:P9_STARTAT,0)||',' 
              ||'"maxResults": '||:P9_MAXRESULTS 
              ||'}'; 

    UTL_HTTP.set_wallet('file:/oracle/ora11/owm/wallets/oracle', 'apex4wallet'); 
    http_req:= utl_http.begin_request 
          (url => 'https://rb-wam.bosch.com/tracker/rest/api/2/search' 
          , method => 'POST'      
          ); 
    utl_http.set_header(http_req, 'Authorization', 'Basic '||:F_JIRA_TOKEN_REST); 
    utl_http.set_header(http_req, 'Content-Type', 'application/json'); 
    utl_http.set_header(http_req, 'Content-Length', LENGTH(lv_json_request)); 
    utl_http.write_text(http_req, lv_json_request); 
    http_resp:= utl_http.get_response(http_req); 
    -- read data from response 
    BEGIN 
     LOOP 
      utl_http.read_text(http_resp, lv_response); 
      HTP.PRN(lv_response); 
      lc_response := lc_response || TO_CLOB(lv_response); 
     END LOOP; 
    EXCEPTION 
     WHEN UTL_HTTP.END_OF_BODY THEN 
      utl_http.end_response(http_resp); 
    END;  
    -- log details 
    --DELETE webservice_log; 
    INSERT INTO webservice_log (seq_id,clob_response,clob_request) VALUES (sqe_Webservice_Log.NEXTVAL,lc_response,TO_CLOB(lv_json_request));   

    --HTP.P(lc_response); 
EXCEPTION 
    WHEN OTHERS THEN 
     RAISE; 
END; 
+0

DB에 이미 있다면, 거기에서 일을하지 않으시겠습니까? – Koshinae

+1

안녕하세요, 제가 언급 한 접근 방식이 효과가 있습니다. 나는 jql에 대해 봤는데, 그것은 생성 된 필드 이름을 사용하여 생성 날짜에 따라 문제를 검색 할 수 있습니다. –

답변

0

당신은 당신의 lv_json_request 문이 뭔가를 추가 할 수 있습니다

"createdDate<='||:P9_CREATED||'" 

필요에 따라 "= <"대신 유효한 연산자를 사용하여.