嵌套For循环迭代PLSQL中的记录

时间:2015-09-07 12:15:27

标签: plsql oracle-sqldeveloper plsqldeveloper

我试图使用嵌套for循环迭代记录,Idea是将记录数组中的所有记录与下一个元素进行比较以检查日期交集。 我的问题是如何填写以下代码代替XXXXXXXX。如上所述,我们的想法是开始将第一条记录与其他所有记录进行比较(使用第二条记录循环)。提前谢谢。

 FOR i IN rx_records.first.. rx_records.last
        LOOP
         FOR j IN XXXXXXXX.. rx_records.last
        LOOP
        IF rx_records(i).eff_startdate <= rx_records(j).eff_enddate AND    rx_records(i).eff_enddate   >= rx_records(j).eff_startdate
        THEN
        DBMS_OUTPUT.PUT_LINE('00'); 
        ELSE
        dbms_output.Put_line('11'); 


        END IF;

        END LOOP;

     END LOOP;

END;

1 个答案:

答案 0 :(得分:1)

我认为以下示例应该符合您的要求(尽管对表格的此类操作在性能方面确实无效):

public class ExpandableTextView extends TextView {

    public ExpandableTextView(Context context) {
        this(context, null, null);
    }

    public ExpandableTextView(Context context, AttributeSet attrs) {
        this(context, attrs, null);
    }

    public ExpandableTextView(Context context, AttributeSet attrs, Runnable runnable) {
        super(context, attrs);

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
        this.trimLength = typedArray.getInt(R.styleable.ExpandableTextView_trimLength, DEFAULT_TRIM_LENGTH);
        typedArray.recycle();

        setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                trim = !trim;
                setText();
                requestFocusFromTouch();
            }
        });
    }

    public ExpandableTextView(Context context, AttributeSet attrs, Activity activity) {
        super(context, attrs);

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
        this.trimLength = typedArray.getInt(R.styleable.ExpandableTextView_trimLength, DEFAULT_TRIM_LENGTH);
        typedArray.recycle();

        setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                trim = !trim;
                setText();
                requestFocusFromTouch();
            }
        });
    }
}