I was making a doom wad file. It uses both Ultimate doom and Doom 2 textures. Adding both Doom 2 and Doom.wad as a resource in Doom builder work just fine. When I test the map in Doom builder, as long as the wad files are added as resources, the ultimate doom textures will appear.

But I started the wad file using GZdoom alone, without testing it using Doom builder. Textures that are not in Doom 2 and are only in Ultimate doom appear as a blue and white grid. Doom 2 textures appear just fine.

How do you load more than one Iwad to get the textures that are used inside the Pwad to appear, both Ultimate Doom and Doom 2 textures?

Doom will only load one IWAD at a time. Essentially, what happens with what you do is that the other IWAD is loaded as if it were a PWAD.

So what you need to do is to explicitly load the other as well. For instance, instead of drag-and-dropping just your mod to gzdoom.exe, select both doom.wad and your mod and drag them both together to gzdoom.exe.

Finally, keep in mind that only the ZDoom port family allow cumulative loading of texture definitions. In other ports closer to the original behavior, there's only one TEXTURE1 lump and only one PNAMES lump that's loaded, so in your case they'd get only the Ultimate Doom textures, and it's the Doom II textures that'd be missing. (And since they're not ZDoom either, they'd probably crash instead of replacing them with a placeholder checkerboard.)