extension cord wiring

I am just trying to understand the NEC 400.8 section a little bit more.
Is it against the code if lets say you install track bar lighting in a room and run the wiring along the ceiling and add an extension cord to run the wiring down to a recep? and could a fix be to add a recep. to the ceiling and use the wiring plug from the track bar and plug-in to the recep on the ceiling?

And I just want to make sure this is okay as well, in my area there are water softener units on the outside of the home, and typically the pumps will be hardwired and they run conduit back to the inside of the home to the panel, but the electronic timer box has a plug and will usually be plugged into the wall receptacle on the exterior, is that okay?

And also say exterior security lights, I understand if you use an extension cord that would be an issue, but would the factory wiring plug run into a receptacle be okay, or does it need to be hardwired.

There are some variables. Do these help?:



Yeah I have read both items, and searched the internet but for some reason it is not clicking in my brain and I am still confused. I realize if I see a ceiling fan plugged into an extension cord then to the recep that would be an issue, but what if the fans build in wiring cord could reach without the extension cord, is that an issue? I realize you can not go through the walls or ceilings, but if the cord stays in the same room. Same with exterior lights, what if the factory cord reaches the receptacle, is that still an issue and needs to be hard wired? And like the water softener wiring from the timer, my house they had to install a recep so that cord would reach and plug in, but I see where some do not add it and will run an extension cord to the recep, I know that is an issue but what about mine that plugs in.

Only temporary or portable fixtures can use extension cords.

I call out every “permanent use” extension cord.

Factory plug-in or hardwired – either one is OK as long as it was installed as prescribed by the manufacturer
See NEC 110.3 (B):
“Installation and Use. Listed or labeled equipment
shall be installed and used in accordance with any instructions
included in the listing or labeling.”*

That said, if it’s a permanent unit that is plugged in, a receptacle suitable for the purpose (e.g. with in-use covers if used outdoors) should be installed close enough to avoid having to use extension cords.
To put it differently, and as others here said, if an extension cord looks like a part of a permanent wiring (e.g. garage door opener connected to the ceiling outlet via an extension cord), I would call it out.

400.8 is there to support you:
Uses Not Permitted. Unless specifically permitted
in 400.7, flexible cords and cables shall not be used for the
(1) As a substitute for the fixed wiring of a structure
(2) Where run through holes in walls, structural ceilings,
suspended ceilings, dropped ceilings, or floors
(3) Where run through doorways, windows, or similar
(4) Where attached to building surfaces

I have never seen a ceiling fan with a flex cord connection.