Question: Consider a very simple application with the project structure

```
-- package.json
-- webpack.config.js
-- src
    |---index.js
    |---runner.js

```

The index.js takes in command line arg to require a file, at runtime. Here is index.js:

```
function requireAtRuntime(filename){
    const runner = require(filename);
    runner.run()
}

var filename = process.argv[2];
requireAtRuntime(filename);

```

runner.js

```
function run(){
    console.log("hello world");
}

exports.run = run

```

package.json contains the script:

```
//
scripts :{  
  "start" : "node src/index.js ./runner.js"
}

```

This start scripts work well. Now the issue if I want to webpack index.js, runner.js is not included as it dependency and the bundle throws the error when i try to run

```
node dist/main.js path/to/runner.js
Error: Cannot find module 'path/to/runner.js'

```

How do I build my webpack so that it can too take filename as command line argument and require it during runtime (or store it before somewhere)?

Answer: 
Supposing that each entrance date has an exit date, you may try the following:

```
Select D.Person,MAX(Entrance) Entrance, MAX(Exit) Exit
From
(
  Select table_name.*,
         MOD(ROW_NUMBER() Over (Partition By Person Order By Entrance, Exit), 
         COUNT(*) Over (Partition By Person)/2) grp
  From table_name
) D
Group By D.Person, D.grp

```

See a [demo](https://dbfiddle.uk/?rdbms=oracle_21&fiddle=6d734ccdeeb1ab88b10ef0ae8ec2515c).
You could also use below solution which takes advantage of ***LEAD*** analytic function with its option ***IGNORE NULLS***.

```sql
select Person, evt_date as Entrance, exit_date as Exit
from (
    select Person, evt_date, evt
        , lead(case when evt = 2 then evt_date else null end, 1) 
            ignore nulls over(
                partition by Person 
                    order by evt_date, evt desc
            ) as exit_date
    from (
        select Person
            , nvl(Entrance, Exit) as evt_date
            , case when Entrance is not null then 1 else 2 end evt
        from YourSampleData
    ) t1
)t2
where evt = 1 /*filter out all the rows initially containing exit dates data*/
order by Person, Entrance
;

```

[demo](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=6ac6810dfbad83241564d3c6fde6b405)